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
-
Have you installed the relevant driver on the remote machine?thatguyfig– thatguyfig2020-11-12 13:24:22 +00:00Commented Nov 12, 2020 at 13:24
-
Yes, I have. Or else I wouldn't have managed to run it directly on the server..Runar Langseth– Runar Langseth2020-11-13 14:06:09 +00:00Commented Nov 13, 2020 at 14:06
Add a comment
|
1 Answer
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)