0

I was trying to open stackoverflow and search for a query and then click the search button. almost everything went fine except I was not able to click submit button

I encountered error

WebDriverException: unknown error: Element ... is not clickable at point (608, 31). Other element would receive the click: (Session info: chrome=60.0.3112.101) (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 6.1.7601 SP1 x86)

 browser=webdriver.Chrome()
    browser.get("https://stackoverflow.com/questions/19035186/how-to-select-element-with-selenium-python-xpath")
    z=browser.find_element_by_css_selector(".f-input.js-search-field")#use .for class and replace space with .
    z.send_keys("geckodriver not working")
    submi=browser.find_element_by_css_selector(".svg-icon.iconSearch")
    submi.click()
3
  • The element is probably moved away by a css hover effect or javascript. Or some other element consumes the click event. I would just try another dom element to submit the click event on. #search input, for instance. Commented Aug 27, 2017 at 14:57
  • i am anaware of css hover or dom element Commented Aug 27, 2017 at 14:59
  • 1
    You should research that, then. It's very useful to know the basics of how a browser works when you use Selenium. Commented Aug 27, 2017 at 15:06

3 Answers 3

2
<button type="submit" class="btn js-search-submit">
    <svg role="icon" class="svg-icon iconSearch" width="18" height="18" viewBox="0 0 18 18">
        <path d="..."></path>
    </svg>
</button>

You are trying to click on the svg. That icon is not clickable, but the button is.

So change the button selector to .btn.js-search-submit will work.

Sign up to request clarification or add additional context in comments.

Comments

2

Use below code to click on submit button:

browser.find_element_by_css_selector(".btn.js-search-submit").click()

Comments

1

Click the element with right locator, your button locator is wrong. Other code is looking good

try this

browser=webdriver.Chrome()
browser.get("https://stackoverflow.com/questions/19035186/how-to-select-element-with-selenium-python-xpath")
z=browser.find_element_by_css_selector(".f-input.js-search-field")#use .for class and replace space with .
z.send_keys("geckodriver not working")
submi=browser.find_element_by_css_selector(".btn.js-search-submit")
submi.click()

Comments

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.