Select an element by the text it contains with Selenium Webdriver

前端 未结 2 907
情深已故
情深已故 2021-01-19 07:09

I\'ve jjust started off with Selenium Webdriver and I\'ve hit an issuee straight away involving the buttons I\'m trying to select/click all have no IDs and share the same cl

2条回答
  •  执念已碎
    2021-01-19 07:32

    Fairly easy if you use xpath. if it has unique text your xpath should look like something like this

    //button[.='xyz']
    

    So, here "." points to the parent in HTML hierarchy and just look for text

提交回复
热议问题