Home > Blockchain >  Selenium: How to use FindElementByXPath to identify the element
Selenium: How to use FindElementByXPath to identify the element

Time:03-01

I need to click on Exportar.

This is the html code

<div >
  <button type="button" title="" style="" >Exportar</button>
  <button type="button" title="" >Cancelar</button>
</div>

CodePudding user response:

Try this :

driver.find_element_by_xpath('//button[@]').click()

CodePudding user response:

To locate the element with text as Exportar you can use either of the following locator strategies:

  • css_selector:

    div.ui-dialog-buttonset > button.call-to-action.ui-button.ui-corner-all.ui-widget.button-default
    
  • xpath:

    //button[@class='call-to-action ui-button ui-corner-all ui-widget button-default' and text()='Exportar']
    
  • Related