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 26, 2019 in Selenium by A
• 150 points

edited May 27, 2019 by Omkar 10,412 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, 2019 by Omkar
• 69,220 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, 2019 by Abha
• 28,140 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, 2019 in Selenium by Abha
• 28,140 points
5,443 views
0 votes
3 answers

How to click the search button using Selenium web driver and Python

You can try with tag. #this code will ...READ MORE

answered Apr 10, 2019 in Selenium by Matin
16,244 views
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,910 points
7,275 views
+1 vote
1 answer
0 votes
2 answers

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,500 points
13,674 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,143 views
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,910 points
7,221 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,874 views
+10 votes
17 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,360 points
197,976 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
• 69,220 points
5,314 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP