2017-01-13 10 views
0

私はセレンを初めて使用しています。 text boxescombo boxの多くをテストするWebページがあります。 sumbitボタンが押されたとき、すなわち既にtexboxesに入力されたデータが挿入され、その下の表に表示されます。コンボボックスとテキストボックスを使用したテーブルデータの比較

textboxcomboboxから各データをフェッチし、テーブルデータと比較する方法

たとえば、commbobox1データは 'IT資産'、combobox2データは 'Monitor'、combox 3データは 'Acer Monitor'です。

を挿入した後、以下の表は、この

Sl.NOのように言及したデータで表示されます|資産の詳細

1 | ITAsset /モニター/エイサー

我々は再び挿入した場合には、シリアル番号を持つ2

下のテーブルに来る間違いあれば親切に無視します。質問はあなたがテーブル内のテキストと各コンボボックスの値のように検証しようとしているものに関してと同様に非常に明確ではないけど、私はセレンwebdriverを、データでのJavaを使用しています

は、Excel

答えて

0

から渡されましたか、 3つのコンボボックスから合計した値。ランタイムの前に行と列の数が不明な場合、以下のコードを使用して動的にWebテーブルを処理できます。

//To locate table. 
    WebElement mytable = driver.findElement(By.xpath("**table-locator**/tbody")); 

//To locate rows of table. 
List<WebElement> rows_table = mytable.findElements(By.tagName("tr")); 

//To calculate no of rows In table. 
    int rows_count = rows_table.size(); 

    //Loop will execute till the last row of table. 
    for (int row=0; row<rows_count; row++){ 

//To locate columns(cells) of that specific row. 
    List<WebElement> Columns_row =  rows_table.get(row).findElements(By.tagName("td")); 

//To calculate no of columns(cells) In that specific row. 
    int columns_count = Columns_row.size(); 
    System.out.println("Number of cells In Row "+row+" are "+columns_count); 

    //Loop will execute till the last cell of that specific row. 
    for (int column=0; column<columns_count; column++){ 
    //To retrieve text from that specific cell. 
    String celtext = Columns_row.get(column).getText(); 
    System.out.println("Cell Value Of row number "+row+" and column number "+column+" Is "+celtext); 
関連する問題