循环,直到然后单击元素

时间:2019-06-07 05:44:04

标签: loops selenium-webdriver while-loop do-while

我想单击查看更多按钮,直到看到某个链接文本元素,然后单击该链接文本。我将如何创建该循环?我尝试了其他方法,但仍然无法正确完成:

WebElement viewmorebutton = wdriver.findElement(By.xpath(".//*[@id='content']/input"));
                    while(checkButton(viewmorebutton)){
                        wdriver.findElement(By.id(TransationListingWeb.getView_more_transactions_button_id())).click();
                        if( wdriver.findElement(By.linkText("LOTTO (20-03-2019)")).isDisplayed()){
                            wdriver.findElement(By.linkText("LOTTO (20-03-2019)")).click();

                        }else
                            wdriver.findElement(By.id(TransationListingWeb.getView_more_transactions_button_id())).click();
                }

0 个答案:

没有答案