WebDriver按下Google按钮

时间:2014-05-21 16:35:04

标签: java button selenium webdriver

任务是按下按钮"更多"在https://play.google.com/store/apps/category/FINANCE/collection/topselling_paid

这是截图 http://c2n.me/i9LC1O

我的代码是:

String url = "https://play.google.com/store/apps/category/FINANCE/collection/topselling_paid";
WebDriver driver = new HtmlUnitDriver();
driver.manage().timeouts().implicitlyWait(100000, TimeUnit.SECONDS);
        driver.get(url);
//Collects ONLY first 60 link. `enter code here`But I need more....
        ArrayList<WebElement> linksToApp = (ArrayList<WebElement>) driver
                .findElements((By.className("title")));
        ArrayList<String> urlToApp = new ArrayList<String>();

请帮助我。

1 个答案:

答案 0 :(得分:0)

您需要执行类似

的操作
driver.findElement(By.id("id-of-show_more-button")).click();

您可以通过右键单击元素找到元素id,单击inspect元素,然后在HTML中检查id属性