我想增/ URL循環使用硒的webdriver遞增/循環與硒URL的webdriver
Ex: Volume 1 : www.abc.com/1/1 www.abc.com/1/2 www.abc.com/1/3 www.abc.com/1/4 Volume 2: www.abc.com/2/1 www.abc.com/2/2 www.abc.com/2/3 www.abc.com/2/4 www.abc.com/2/5
等。
1. Once the Volume 1, Issues 4 Fished moves into Volume 2 and check all issues and moves into Next Volume 3..
0
A
回答
1
簡單的for循環是有幫助在你的場景中。你可以使用Java來做到這一點,如下:
{
System.setProperty("webdriver.chrome.driver", "D:/Selenium/Drivers/chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
int i,j;
for(i=1;i<5;i++)
{
for(j=1;j<10;j++)
{
String url = "https://website.com/"+i+"/"+j+"";
driver.get(url);
}
}
}
我是你的第一卷的數量,j是你提到的問題的數量。 您可以根據您的要求定義它。
希望它能幫助你。
0
從測試數據中讀取每個頁面的卷數和發佈計數。然後使用for循環迭代,如下所示。我假定ReadVoulmentCount方法的返回數量和ReadIssueCount方法返回頁面的問題數量。
{
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
int volumeCount=ReadVolumeCount();
int issueCount=0;
for(int volumeNo=1;volumeNo<volumeCount;volumeNo++)
{
issueCount=ReadIssueCount(volumeNo)
for(int issueNo=1;j<issueCount;issueNo++)
{
String url = "https://website.com/"+volumeNo+"/"+issueNo+"/";
driver.get(url);
}
}
}
+0
謝謝你的幫助。 – Dana
相關問題
- 1. Python的硒Webdriver - 嘗試除了循環
- 2. 使用硒webdriver通過表循環
- 3. for循環遞增
- 4. 遞歸循環Selenium Webdriver
- 5. 變量的循環遞增
- 6. 遞增的變量循環
- 7. 與JAVA的硒webdriver
- 8. 與tomcat的硒webdriver
- 9. 與硒和perl XPath循環
- 10. numpy:ravel_multi_index遞增循環索引循環不同的結果循環
- 11. C#For循環不遞增
- 12. PHP遞增while循環
- 13. PHP foreach循環不遞增
- 14. PHP for循環不遞增
- 15. 在循環內遞增DateInterval
- 16. 使用循環遞增值
- 17. python遞增字符循環
- 18. SQL循環和遞增
- 19. 爲每個循環遞增
- 20. Java嵌套for循環第一循環遞增第二循環?
- 21. 與硒的webdriver的Python
- 22. 如何與硒webdriver的IE
- 23. 硒webdriver的問題與By.cssSelector
- 24. 用於與硒的webdriver
- 25. 不能與硒的webdriver
- 26. 爲什麼我的for循環不硒webdriver的工作
- 27. 在遞增遞增的for循環中更新變量
- 28. While循環即遞增變量的點
- 29. 循環中的Bash遞增變量
- 30. 循環內部的遞增操作
@Dana請找到更新後的答案。 – RNS
@RSN完美,增強了我的代碼其工作完美,謝謝 – Dana