How to click button selenium python?

+1 vote

I'm trying to click on a dropdown button but it isn't working for me.

    <button class="size-grid-dropdown size-grid-button" data-qa="size-dropdown">EU 44</button>

What I'm using:

    driver.find_element_by_xpath('//*[@id="root"]/div/div/div[1]/div/div[3]/div[2]/div/section[1]/div[2]/aside/div/div[2]/div/div[2]/ul/li[9]/button').click()

I get the error:

    selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
  (Session info: chrome=75.0.3770.52)

When I'm using:

    element = WebDriverWait(driver,20).until(EC.presence_of_element_located((By.XPATH, '//*        [@id="root"]/div/div/div[1]/div/div[3]/div[2]/div/section[1]/div[2]/aside/div/div[2]/div/div[2]/ul/li[11]/button"]')))
driver.execute_script("arguments[0].click();",element)

I get the error:

        raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:

Can someone help me? I dont know what I'm doing wrong

May 25 in Selenium by A
• 150 points

edited May 27 by Omkar 1,241 views

2 answers to this question.

+1 vote

Try something like this, it worked for me:

from selenium import webdriver
from selenium.webdriver.support.ui import Select
select = Select(driver.find_element_by_id('type id here'))
select_.select_by_index(0)
answered May 27 by Omkar
• 67,620 points
+1 vote

Have you tried using implicit_wait method before getting the webpage? You can use this line before calling driver.get() method:

driver.implicitly_wait(2)

You can also use this method before calling driver.find_element_by_xpath():

time.sleep(time_in_seconds)
answered May 27 by Abha
• 24,320 points

Related Questions In Selenium

0 votes
2 answers

Python & Selenium: How to find and click on YouTube's Like button

Hello Nitin, as the Like button on ...READ MORE

answered Aug 23 in Selenium by Abha
• 24,320 points
636 views
0 votes
3 answers
0 votes
1 answer

How to click a span with given text using Selenium Python

If ALL_USA is subject to change, then ...READ MORE

answered Jul 26, 2018 in Selenium by Samarpit
• 5,130 points
1,903 views
+1 vote
1 answer
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,090 points
750 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
998 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
709 views
+9 votes
14 answers

How to automate gmail login process using selenium webdriver in java?

Check the below code: Here is the working ...READ MORE

answered Apr 24, 2018 in Selenium by Vardy
• 2,250 points
64,858 views
+1 vote
2 answers

selenium-python Process unexpectedly closed with status 1

Hi paragf! I checked your code.  Firstly, there ...READ MORE

answered Sep 28, 2018 in Selenium by Omkar
• 67,620 points
130 views