I want to click the "Next" link
Hi! I've been trying to scrape data for some project I have. I'm still new at using Selenium but I've been able to do the basics. What I want to do now is for the program to click the "Next" link above to move to the next page to scrape more data. Please help.
The desired element is a Angular element so you have to induce WebDriverWait for the element to be clickable and you can use either of the following solution:
cssSelector
:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("li.ng-scope[translate='next']"))).click();
xpath
:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//li[contains(@class,'ng-scope') and @translate='next'][contains(.,'Next')]"))).click();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.