lundi 6 juillet 2020

Xpath to click toggle button in web table

While trying to automate my application, one of the webpage has a toggle button inside a table and i need to select the same.

Below is the image of HTML code.I am unable to copy paste the code hence attaching the image.

enter image description here

Below is the code tried but getting error as unable to locate element.

IWebElement btn3 = driver.FindElement(By.XPath("//input[@id='livingExpenseConsent']/ancestor::span"));
            Actions action2 = new Actions(driver);
            action2.MoveToElement(btn3).Click().Perform();

Kindly suggest the right way to locate the element.

Aucun commentaire:

Enregistrer un commentaire