简体   繁体   中英

PythonAnywhere issue with chromedriver

have a working python script and tried migrating it to PythonAnywhere. It throws an wrror saying no element found in web scraping script. where as same code gets executed in the local machine.

service_log_path = "chromedriver.log"
service_args = ['--verbose']
choptions = webdriver.ChromeOptions()
choptions.add_argument('--headless')
choptions.add_argument('--no-sandbox')
choptions.add_argument('--disable-extensions')
choptions.add_argument('--disable-gpu')
browser = webdriver.Chrome(options=choptions,service_log_path=service_log_path)
browser.get('xyz.com')
time.sleep(10)
username = browser.find_elements("id","abc")

I would assume it is a path issue. If it is going from a local machine to non-local. Your PythonAnywhere likely can not find choptions = webdriver.ChromeOptions() or maybe service_log_path = "chromedriver.log" .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM