2

I tried searching for the solution but nothing worked so this is my last hope. none of the other stackoverflow cases worked for me.

I try to run

from selenium import webdriver
b=webdriver.Chrome()

b.get("www.google.com")

but it only opens a "data:," page with nothing.

In the terminal there is

DevTools listening on ws://127.0.0.1:50361/devtools/browser/fef860a9-fd7b-4e53-9367-b7e59b57fa66
Traceback (most recent call last):
  File "c:/Microsoft VS Code/CODES/bot.py", line 4, in <module>
    b.get("www.google.com")
  File "C:\Users\istiak\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 333, in get
    self.execute(Command.GET, {'url': url})
  File "C:\Users\istiak\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\istiak\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument
  (Session info: chrome=85.0.4183.121)

this. whats the best approach to this problem? thank you very much.

1

1 Answer 1

3

The .get() parameter must be a valid formatted url and looking at the docs you would get InvalidArgumentException when

The arguments passed to a command are either invalid or malformed.

Try adding http:// or https:// to your webdriver.get(), as Selenium considers urls starting with www... as invalid:

b.get("https://www.google.com")
Sign up to request clarification or add additional context in comments.

1 Comment

I feel very stupid right now... Thank you so much. i had sleepless night for this. :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.