selenium 4 raises exception
example code:
python
driver = webdriver.Chrome()
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.clear()
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()
issue log:
Traceback (most recent call last):
...
File "C:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 193, in check_response
raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message:
investigation:
Run below code:
python
from selenium import webdriver
import logging
logging.basicConfig(level=logging.DEBUG)
def main() -> int:
browser = webdriver.Firefox()
browser.get('http://selenium.dev/')
return 0
if __name__ == "__main__":
raise SystemExit(main())
From the output, it shows something related to proxy.
solution:
- downgrade to selenium 3.14.1
- remove proxy in environment variable