Issue
Here is my HTML element
<div _ngcontent-rju-c99="" class="mb-5 custom-control custom-checkbox">
<input _ngcontent-rju-c99="" required="" type="checkbox" id="tosAccept" name="tosAccept"
angularticslabel="AcceptCgu" angularticsvalue="tosAccepted ? 'accepted' : 'notAccepted'"
class="custom-control-input ng-untouched ng-pristine ng-invalid"> ==$0
<label _ngcontent-rju-c99="" for="tosAccept" class="custom-control-label">Acepto las
<a href="some link" target="_blank">condiciones generales de uso</a>
</label>
</div>
I want to click on the input, which is a checkbox that enable a button, the problem is that i just can't, tried all selectors possible (id, name, css, by xpath, by name by id ...) nothing works, the fun fact is that input doesn't end ! ( no ) which may cause this problem, but its possible with angular i guess.
Of course i have my timers set (wait.until(ExpectedConditions.visibilityOfElementLocated
)
Any solution please ? i'm stuck on this since days
Solution
resolved with
WebElement checkbox = driver.findElement(By.id("tosAccept"));
((JavascriptExecutor)driver).executeScript("var elem=arguments[0]; setTimeout(function() {elem.click();}, 100)", checkbox);
Answered By - Hamza Amami
Answer Checked By - Mildred Charles (JavaFixing Admin)