I am unable to click on logout link in my web page using XPath.
XPath: html/body/div[1]/span/div[1]/a[1]
I See my code in an attachment:
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It only takes a minute to sign up.
Sign up to join this communityI am unable to click on logout link in my web page using XPath.
XPath: html/body/div[1]/span/div[1]/a[1]
I See my code in an attachment:
Switch to the iframe first, for that try the below code.
driver.switchTo().frame(driver.findElement(By.cssSelector("iframe[src*=sfactory]")));
After that you can use the XPath or CSS selector to identify the locator.
css: a[onclick*=exitAction]
xpath: //a[contains(@onclick, 'exitAction')]
Try this below XPath.
//a[contains(text(),'[Logout]')]
Prefer Relative XPath rather than Absolute XPath.
Try the below code using LinkText locator for locating the logout button.
driver.findElementBy.linkText("[Logout]")