'Getting selenium.common.exceptions.InvalidArgumentException: Message: invalid argument
I have a selenium automation code where I am getting
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument
I think it is related to URL that I am sending through command line, Its what causing 'InvalidArgumentException'. I am passing the URL like this
"https://www.hotstar.com"
Below is my code
test_mycode.py
from datetime import datetime
def test_Openurl(setup):
driver = setup["driver"]
url = setup["URL"]
try:
before_time = datetime.now().strftime('%H%M%S%f')
driver.get(url)
now_time = datetime.now().strftime('%H%M%S%f')
except Exception as e:
print(e.message)
assert driver.current_url == URL
driver.save_screenshot("ss.png")
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
driver.save_screenshot("ss1.png")
driver.close()
My Conftest.py has no issue in it, the setup is passed, I genuinely feel that the issue is in the format of URL.
The error that I am getting is
"call": {
"duration": 0.004477769000004628,
"outcome": "failed",
"crash": {
"path": "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/errorhandler.py",
"lineno": 247,
"message": "selenium.common.exceptions.InvalidArgumentException: Message: invalid argument\n (Session info: headless chrome=90.0.4430.72)\nStacktrace:\n#0 0x55f76d8bfe89 <unknown>"
},
Which is related to invalid URL, The command through which I am passing the URL is
pytest -v -s --json-report --json-report-indent=4 --json-report-file=report/report.json --html=report/report.html test_mycode.py --url "https://www.hotstar.com"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
