Reputation: 174
Im trying to click on a weird element, which is this :
<a href="#">Cliquer pour révéler</a>
It has nothing else than this, also just in case you would like to know what it looks like : https://i.sstatic.net/9Nomj.png
When using driver.findElement(By.xpath("//*[contains(@text, 'Cliquer ici pour révéler')]")).click();
It returns me that it has found nothing.
Anybody know how i could click on it ? =)
And also, i cannot click on this element as well :
<button class="modalFooterButton-XdS1ri footerButtonBase-1O2g9P" value="true">Oui, faites-le !</button>
Using this : driver.findElement(By.xpath("//*[contains(@class, 'modalFooterButton-XdS1ri footerButtonBase-1O2g9P')]")).click();
It is returning me this : https://i.sstatic.net/QKE6n.png Thanks in advance to anybody that will help me on these =)
Upvotes: 0
Views: 504
Reputation: 29362
try this :
Actions action = new Actions(driver);
action.moveToElement(driver.findElement(By.xpath("//button[contains(text(),'Oui, faites-le')]"))).build().perform();
driver.findElement(By.xpath("//button[contains(text(),'Oui, faites-le')]")).click()
and for this : <a href="#">Cliquer pour révéler</a>
You can use linkText , but that will not do anything since href does not have any value.
UPDATE :
Since, you have mentioned that even when you click manually on , some tokes are being released.
Try to click on it using selenium , and then explicitly tell your web driver to wait till hidden items are present in DOM.
Code :
driver.findElement(By.linkText("Cliquer pour révéler")).click();
new WebDriverWait(driver,20).until(ExpectedConditions.visibiltyOfElement(By.xpath("//div[@class='token']")))
Upvotes: 1