david
david

Reputation: 6785

How to click 'Submit' button using a specific tag with Selenium

Page source code below:

<button class="ui-button-primary ui-button ui-widget ui-state-default 
ui-corner-all ui-button-text-only" type="submit" data-
qa="sidebar.find.submit.button" role="button" aria-disabled="false">
<span class="ui-button-text">Find</span></button>

How do I click this button with Selenium Webdriver and is it possible to click it using the qa=sidebar.find.submit.button

Upvotes: 0

Views: 734

Answers (3)

Pierre Dewas
Pierre Dewas

Reputation: 75

And in python, this way :

driver.find_element_by_xpath("//button[@data-qa='sidebar.find.submit.button']")).click();

Upvotes: 0

abhijeet kanade
abhijeet kanade

Reputation: 161

Here you Go

driver.findElement(By.xpath("//button[@data-qa='sidebar.find.submit.button']")).click();

Upvotes: 0

alecxe
alecxe

Reputation: 473853

Sure, you can use a CSS selector:

driver.find_element_by_css_selector('button[data-qa="sidebar.find.submit.button"]')

Upvotes: 1

Related Questions