OiO.lk Blog java How to move from Yes to No in toggle switch using selenium java
java

How to move from Yes to No in toggle switch using selenium java


Here i need to move from Yes to No, so please guide me how to locate xpath for toggle swithcer, and please refer below html code

    WebElement toggleswitch =wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//input[@id='mfaEnabledId']/following::label[@for="switcher"]")));
        toggleswitch.click();

i have used this xpath but it throws error like this

FAILED: verifyUserCreaton("naresh", "123", "nareshponnusamy77@gmail.com", "Naresh123", "Naresh@14499", "Naresh@14499")
org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <label for="switcher" style="width: 50%;"></label> is not clickable at point (468, 561). Other element would receive the click: <input type="checkbox" id="mfaEnabledId" style="width: 100%;">
  (Session info: chrome=129.0.6668.101)

HTML

<div class="col-md-6" style="position: relative; top: 5px;">
 <div class="switcher">
  <input type="checkbox" id="mfaEnabledId" style="width: 100%;">
  ::before
  ::after
  </input>
  <label for="switcher" style="width: 50%;">
  </label>
 </div>
</div>



You need to sign in to view this answers

Exit mobile version