2016-10-31 1 views
-1

EclipseでSelenium Webdriverを使って作業しています。私はそれがフィールドを記入し、ラジアルボタンにをチェックしてから閉じ、その後、ループループセレンをWebページのリスト

http://www.sample.com/catalog?product_id="0002"` 

オープンと同じアクションを実行

http://www.sample.com/catalog?product_id="0001" 

を開きたいです。私はそれが9990に達するまでループすることを望みます。

System.setProperty("webdriver.firefox.marionette","/Users/Downloads/geckodriver"); 
WebDriver driver; 
driver = new FirefoxDriver(); 
String base = ("http://www.sample.com/catalog?product_id="0001"); 
+0

TestNg/Junitでデータ駆動型テストを検索します。ここにTestNg [リンク]の例があります(http://www.software-testing-tutorials-automation.com/2014/05/webdriver-test-data-driven-testing.html) – Knu8

+1

あなたは何を達成しようとしましたか?ループ?あなたのコードを投稿してください。 – JeffC

答えて

0

コードスニペット:あなたが望んでいたし、必要なページ上の土地として

for(int i = 1; i <= 9990; i++){ 
     String base = "http://www.sample.com/catalog?product_id=" + String.format("%04d", i); 
     driver.get(base); 
     //do your stuff here 
    } 

上記のコードスニペットは、あなたのURLを構築します。