Вопрос

I have a block, "Categories". This block has a invisible config link (config link: <a class="contextual-links-trigger" href="#">Configure</a>) When i manual move mouse to this block, config link become to <a class="contextual-links-trigger contextual-links-trigger-active" href="#">Configure</a> and config icon displays (base on the new class "contextual-links-trigger-active"). when i click config icon, link "Edit view" will display. (see image)

image link: https://www.facebook.com/photo.php?fbid=448612048582483&set=a.152871061489918.29073.100003010769102&type=1&theater

I want to click link "Edit view" use java web driver. I used code below to display config icon but not successful:

Actions builder = new Actions(driver);
        builder.moveToElement(driver.findElement(By.xpath(xpath))).perform();

Please give me some ideas. Thanks!

Это было полезно?

Решение

you can use JavascriptExecuter to click on the invisible link,

((JavascriptExecutor)driver).executeScript("$('.contextual-links-trigger').click();");

then you can wait for visibility of Edit View and use click,

new WebDriverWait(driver,30).until(ExpectedConditions.visibilityOfElementLocated(By.linkText("Edit view"))).click();
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top