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

0 votes

I am trying to click the button but it is not working

<button value="1" class="_42ft _4jy0 _4w98 _4jy3 _517h _51sy _4w97" aria-

label="Search" tabindex="-1" data-testid="facebar_search_button" 

type="submit"><i class="_585_"></i></button>
Jul 19, 2018 in Selenium by Martin
• 4,320 points
15,629 views

3 answers to this question.

0 votes

Below will help
Use xpath :- //button[@value='1' and @label='Search']

searchbutton = driver.find_element_by_xpath(//button[@value='1' and @label='Search'])
answered Jul 19, 2018 by Samarpit
• 5,910 points
This solution is not working.It still gives an error.
Can you please provide the error that you are facing?
0 votes

Try this will work:

JavascriptExecutor js = (JavascriptExecutor) driver;//create instance of javascript executor to do actions
WebElement buttonSubmit= driver.findElement(By.xpath("//button[@class='_42ft _4jy0 _4w98 _4jy3 _517h _51sy _4w97']"));
js.executeScript("arguments[0].click();", buttonSubmit);
answered Feb 21, 2019 by nizam
0 votes

You can try with tag.

#this code will get the list of tags and select the second tag from the list
element = driver.find_elements_by_tag_name('button')[1] 
#this will click the element
element.click()

Ref: https://stackoverflow.com/questions/49063338/trying-to-click-on-the-button-tag-in-selenium-web-driver-using-python

answered Apr 10, 2019 by Matin

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
4,897 views
+1 vote
1 answer
0 votes
0 answers
0 votes
1 answer

Installing Selenium Webdriver with Python package

Hey Hemant, for installing Selenium Webdriver with ...READ MORE

answered May 8, 2019 in Selenium by Anvi
• 14,150 points
15,121 views
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
12,576 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
8,559 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
6,606 views
+1 vote
1 answer
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
6,880 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