Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Which locator should I use for Click Button when Id is not static?

I am new at selenium Java. Using Facebook example, I tried to write button click function using eclipse. For "Create New Account" button I tried using find element by id but it was not working because id is not static. Then I tried find element by class but an error occur that compound class cannot be used.
I have tried XPath but it is also not working. What web element can I use to locate this button?

Inspect element on Create an account button

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can use this CSS Selector:

a[data-testid="open-registration-form-button"]

or this XPath

//a[@data-testid="open-registration-form-button"]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading