0

I'm trying to run this simple Python webbot example on Ubuntu 22.04:

from webbot import Browser

web = Browser()
web.go_to('google.com')
web.type('hello its me')  # or web.press(web.Key.SHIFT + 'hello its me')
web.press(web.Key.ENTER)
web.go_back()
web.click('Sign in')
web.type('mymail@gmail.com' , into='Email')
web.click('NEXT' , tag='span')
web.type('mypassword' , into='Password' , id='passwordFieldId')
web.click('NEXT' , tag='span') # you are logged in . woohoooo

However, when I run the example using Python3 I get this error:

    web = Browser()
  File "/usr/local/lib/python3.10/dist-packages/webbot/webbot.py", line 68, in __init__
    self.driver = webdriver.Chrome(executable_path=driverpath, options=options)
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/chrome/webdriver.py", line 80, in __init__
    super().__init__(
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/chromium/webdriver.py", line 104, in __init__
    super().__init__(
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 286, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 378, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created exception: Missing or invalid capabilities
  (Driver info: chromedriver=2.39.562737 (dba483cee6a5f15e2e2d73df16968ab10b38a2bf),platform=Linux 5.19.0-38-generic x86_64)

I installed Chrome using:

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb

How do I resolve this?

I am very new to this, I literally just want to log in to a website, don't care what browser.

I Googled to try and find how to use Firefox instead, but the name of the library made searching difficult.

rare77
  • 297
  • 6

1 Answers1

0

what version of selenium are you using? I have seen issues with webbot when you use any version higher than 3.141.0 for selenium. If you have higher version, you will have to replace it with this one and then try running your script.

Prem
  • 46
  • 3