Python webbot showstopper, can not use webbot because of Chrome driver

456 views Asked by At

Its been a long while since i have been on this platform so here goes. I have just started using pythons webbot library. I think it is a pretty cool library from a developer stand point. It pretty much is way better than most for basic online automation tasks. I have a problem that basically stops me from using it. This is the code i have:

from webbot import Browser

web = Browser()

print(web)

The error message is:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created exception: Missing or invalid capabilities
(Driver info: chromedriver=2.39.562718 (9a2698cba08cf5a471a29d30c8b3e12becabb0e9),platform=Windows NT 10.0.19044 x86_64)

Now i have seen that there have been several answers to this type of question as i have copied and pasted the error message into a search engine and up popped a few answers some didn't go into enough detail and some just didn't plain work. I can use Selenium for what i need to do, but it seems to me that the webbot library is more streamlined and easier to use. Does anyone know how to fix this, and if the webbot dev team will be adding any other browsers to the webbot library. Thank you for your time and effort to all who answer.

2

There are 2 answers

2
Emil T On

Given message means that it was unable to initiate browser session for 2 reasons:

  1. Whether driver version indeed is not suitable
  2. Webbot can't find Chrome binaries and error is just generic

I'm not sure what solutions you've already tried, but try to:

1.Play with drivers from here (>= 76.x.x) https://chromedriver.storage.googleapis.com/index.html

  1. Try to explicitly indicate driver location via Options
options = Options()
options.binary_location=r'home/localhome/seeking_code_mastery/driver'
web = webdriver.Chrome(options=options, executable_path='home/localhome/seeking_code_mastery/chrome.bin')
0
Leo On

I have spent some time on this and have found a solution that seems to have worked:

  1. Check your current version of Chrome browser.
  2. Go to https://chromedriver.chromium.org/downloads and download the correct driver for your version, then unzip it.
  3. Navigate to webbot's drivers folder - I used Anaconda and for me, it was C:\ProgramData\Anaconda3\Lib\site-packages\webbot\drivers.
  4. Copy the Chrome driver into the driver folder and rename it chrome_windows.exe.

This was enough to open a browser with webbot. However, it generated a new error message 'WebDriver' object has no attribute 'switch_to_alert'.

To resolve this, I then had to downgrade Selenium to 3.141.0, as per the helpful post below. I couldn't uninstall Selenium via pip, so I had to manually delete the Selenium folders from the C:\ProgramData\Anaconda3\Lib\site-packages folder before reinstalling the older version. https://github.com/nateshmbhat/webbot/issues/62

Seems to work now. It's a shame that webbot has fallen by the wayside as a project.