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.

0buz
  • 3,443
  • 2
  • 8
  • 29
  • Does this answer your question? [selenium.common.exceptions.InvalidArgumentException: Message: invalid argument error invoking get() with urls read from text file with Selenium Python](https://stackoverflow.com/questions/59755609/selenium-common-exceptions-invalidargumentexception-message-invalid-argument-e) – Christian Baumann Oct 05 '20 at 14:30

1 Answers1

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")
0buz
  • 3,443
  • 2
  • 8
  • 29