I’m trying to click a button with selenium using a simple automated login screen test.
I am running this test on 2 separate accounts with 2 a little bit different login screens.
The first one works as expected, where I can just locate the button with “SPAN” (because thats how it is set up):
”’ Sign in ”’
However, the second login page has a little bit different setup:
”’Sign in”’
The first page works using this code:”’sm.click(driver, “//span[text()=’ Sign in ‘]”)”’
but with the second one Selenium has trouble picking it up.
Any suggestions?
I tried adding pauses before the click since I assumed that this might be caused by the button element not being available before being pressed but thats not the case. Experimented with for example this code for the button without a span:
”’sm.click(driver, ‘//button[@class=”mat-focus-indicator mat-raised-button mat-button-base mat-primary ng-star-inserted”‘)”’
but it didnt work
user25148987 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.