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,210 points
1,589 views

3 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,130 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 20 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 by Matin

Related Questions In Selenium

0 votes
1 answer

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

Use the CSS Selector button to like: #watch8-sentiment-actions ...READ MORE

answered Mar 26, 2018 in Selenium by nsv999
• 5,050 points
460 views
+1 vote
1 answer
0 votes
1 answer

Installing Selenium Webdriver with Python package

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

answered May 8 in Selenium by Anvi
• 7,160 points
25 views
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,050 points
130 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
519 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,130 points
1,299 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.