user8162541
user8162541

Reputation:

Python Splinter cannot click button

I am running through the Splinter tutorial located here: http://splinter.readthedocs.io/en/latest/tutorial.html#

The code I am using:

from splinter import Browser
browser = Browser()
browser.visit('http://google.com')
browser.fill('q', 'chicago pizza')
button = browser.find_by_name('btnG')
button.click()

Every time I try to get my code to click the search I get the following error:

Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    button.click()
  File "C:\Python27\lib\site-packages\splinter\driver\webdriver\__init__.py", line 546, in click
    self._element.click()
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 77, in click
    self._execute(Command.CLICK_ELEMENT)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 493, in _execute
    return self._parent.execute(command, params)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 256, in execute
    self.error_handler.check_response(response)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
ElementNotInteractableException: Message: 

I have used browser.find_by_id, browser.find_by_tag, browser.find_by_text and none have worked, all giving me the same error.

I am running python 2.7.8 Firefox v 54.0.1 (32-bit) and have selenium installed. Any idea of how to fix this? I think it may have to do with my geckodriver.

I would like to solve the problem and not have to work around it by say switching web browsers.

Upvotes: 0

Views: 495

Answers (1)

ksai
ksai

Reputation: 977

Everything worked fine except you have entered wrong name of button.

Here is the working code

from splinter import Browser
browser = Browser()
browser.visit('http://google.com')
browser.fill('q', 'chicago pizza')
button = browser.find_by_name('btnK')
button.click()

Upvotes: 1

Related Questions