Using Python Selenium Not able to perform click operation

  • I am automating for the following page on CHROME Browser

    Here I'm able to identify the unique element from the console for the XPATH used

    $x('//button[text()="START STUDY"]')

    But when the same code is integrated with the script and run.

    Integrated Script -

    from selenium.webdriver import Chrome
    driver = Chrome('/Users/downloads/chromedriver')
    driver.find_element_by_xpath('//button[text()="START STUDY"]').click()

    I get the following error

    Traceback (most recent call last):
      File "/Users/PycharmProjects/Practice/", line 54, in <module>
        driver.find_element_by_xpath('//button[text()="START STUDY"]').click()
      File "/Users/PycharmProjects/Study/venv/lib/python3.7/site-packages/selenium/webdriver/remote/", line 80, in click
      File "/Users/PycharmProjects/Study/venv/lib/python3.7/site-packages/selenium/webdriver/remote/", line 633, in _execute
        return self._parent.execute(command, params)
      File "/Users/PycharmProjects/Study/venv/lib/python3.7/site-packages/selenium/webdriver/remote/", line 321, in execute
      File "/Users/PycharmProjects/Study/venv/lib/python3.7/site-packages/selenium/webdriver/remote/", line 242, in check_response
        raise exception_class(message, screen, stacktrace)
    selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <button class="ui button" role="button" style="background-color: rgb(31, 186, 238); color: white; border-radius: 0px; padding-left: 40px; padding-right: 40px; font-family: &quot;Open Sans&quot;; font-size: 17px; font-weight: 600; line-height: 20px; text-align: center; width: 200px; height: 50px; margin-top: 26px;">...</button> is not clickable at point (1047, 320). Other element would receive the click: <div>...</div>
      (Session info: chrome=76.0.3809.132)

    I have tried to click on the element using the ActionChains class as well. Even then the same issue is got

  • Try using JavaScriptExecutor


    IWebElement element = driver.FindElement(By.XPath("//button[@role='button']"));
    IJavaScriptExecutor jse2 = (IJavaScriptExecutor)driver;
    jse2.ExecuteScript("arguments[0].click()", element);


    element = driver.find_element_by_xpath("//button[@role='button']")
    driver.execute_script("arguments[0].click();", element)

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2