문제

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