Runar Langseth
Runar Langseth

Reputation: 11

Calling Python script with Selenium Webdriver from PC on a server

I have a Python script that uses Selenium Webdriver. I want to run this on a server remotely. When running my script directly on the server through command window, everything works fine. But when I'm trying to trigger this remotely through a program on my local PC to the server, it doesn't work. It seems to stop at driver = webdriver.Chrome(webdriverlink). It doesn't fail, it just won't continue. So it seems like it doesn't actually opens a browser.

Isn't this possible when you're not logged in on the server and not running it directly from there?

I've saved my script in a py-file, and is triggering it in both ways throuh the command line python <myFileName>.py

Upvotes: 0

Views: 444

Answers (1)

Runar Langseth
Runar Langseth

Reputation: 11

I found a solution from another forum after a lot of searching. So for all of you struggling with the same problem, this worked for me:

I've added the following code:
options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])

and changed from: driver = webdriver.Chrome(webdriverlink)
to driver = webdriver.Chrome(executable_path=webdriverlink,options=options)

Upvotes: 1

Related Questions