问题
I´m newbie to python and selenium. I´m creating app with GUI in web browser and the logic is executed in python under Apache. I have written some selenium scripts that work perfect when testing seperately outside Apache. But when I try to execute Selenium script under Apache on localhost, new Chrome or Firefox window won´t open. Apache with Python is confugured correctly --> able to run other python scripts. So here is my code:
PYTHON
!#path to python
from selenium import webdriver
import selenium.webdriver.chrome.service as service
service = service.Service('C:\\wamp64\\www\\chromedriver.exe')
service.start()
capabilities = {'chrome.binary': 'c:/Program Files (x86)/Google/Chrome/Application/chrome.exe'}
driver = webdriver.Remote(service.service_url, capabilities)
driver.get('https://www.google.com/')
#Here is code to get var div_text
print("Content-type: text/html\n\n")
print(div_text)
I am quite lost here, because new Chrome window won't open a Apache error log is empty. What am I missing here? Tested on python 3.4.0 and 3.6.3 with same results --> works fine from prompt (no Apache), doesn't work on localhost(Apache)
Only thing that came to my mind was that scripts on Apache server do not have the permission to execute WIN apps.
Thanks for your advice
来源:https://stackoverflow.com/questions/47756551/cannot-run-python-selenium-script-under-localhost