I am automating login on Workday portal using Chrome webDriver in selenium, how do I click on the hidden sign-in button, which is defined as:
<div class="css-1s1r74k">
<div font-size="14" height="40" aria-label="Sign In" role="button" tabindex="0" data-automation-id="click_filter"
class="css-1n9xe37">
</div>
<button type="submit" data-automation-id="signInSubmitButton" font-size="14" height="40" class="css-a9u6na" tabindex="-2" aria-hidden="true">Sign In</button>
</div>
Here’s the code I am using, but it is not able to perform the click action on the specific button:
signInButton = driver.find_element(By.XPATH,'//*[@id="wd-Authentication-NO_METADATA_ID-uid6"]/div/div[1]/div/form/div[3]/div/div/div/div/button')
driver.execute_script("arguments[0].click();", signInButton)
Here’s the login page sample – https://wd1.myworkdaysite.com/en-US/recruiting/snapchat/snap/login
2
Answers
The BUTTON isn’t hidden. You can see the "Sign In" text on the button from the HTML you provided. I’m not sure why your code doesn’t work, it’s possible you need to add a wait. I updated the locator to a CSS selector because they are better supported and that XPath you are using is brittle since it has so many levels, indices, etc.
Basically if you see the Html,
div
element has a role attribute button and which is clickable.Try following code to click on the
Sign In
Button.you need following imports
Browser snapshot: