Domanda

I want to click on next arrow of a carousel till the end of loop. now how do i click constantly on the next arrow using selenium webdriver ?? I did for-loop in the click but its not working. This is the basic code for the element and click.

element = driver.findElement(By.xpath(".//*[@id='hp_category_tab_electronics_0-content']/div[1]/div/div/a[2]"));
element.click();

so in short i want to click on next arrow button for like 5 times before the end of products is encountered.

È stato utile?

Soluzione

element = driver.findElement(By.xpath(".//*[@id='hp_category_tab_electronics_0-content']/div[1]/div/div/a[2]"));
element.click();
for(int i=0;i<4;i++);{
        Thread.sleep(500);
        element.click();
    }

I found the code actually i was not using thread.sleep(); before.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top