1

私はアプリケーションを自動化するためにSelenium 3.0とFireFox 48を使用しています。しかし、firefox48では、ドロップダウンを選択するための自動化は機能しません。セレンのwebdriverを使用しているドロップダウンがfirefox 48で機能していません

IEとChromeで同じコードが問題なく動作しています。

この問題はブラウザまたはコードでも発生しますか?

enter image description here

Select sel = new Select(driver.findElement(By.xpath("//select[contains(@id,'BusinessUnit')]"))); 
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("ctl00_vmsContent_rdwBusinessUnit_C_selBusinessUnit"))); 
List<WebElement> list = sel.getOptions(); 
for (WebElement el : list) 
{ 
    System.out.println(el.getText()); 
    sel.selectByIndex(2); 
} 
+0

この回答http://stackoverflow.com/questions/39224373/unable-to-select-dropdown-option-after-updating-jar-files-to-selenium-3-0/39228389#39228389をお試しください –

+0

@naveen、何か問題がありますか? –

答えて

0

私は、コードを少し合理化でしょう。私はデバッグの目的で少しのコードを追加しました。

// wait until returns a WebElement, store it for later use 
WebElement e = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//select[contains(@id,'BusinessUnit')]"))); 
// dump the HTML of the select element and make sure you have the element you are expecting 
System.out.println(e.getAttribute("outerHTML")); 
Select sel = new Select(e); 
for (WebElement el : sel.getOptions()) 
{ 
    System.out.println(el.getText()); 
} 
sel.selectByIndex(2); // pull this out of the loop or it will get selected mutliple times 
// other options for selecting the desired OPTION 
sel.selectByValue("12"); 
sel.selectByVisibleText("Engineering"); 
+0

解決策はありますか? – HemaSundar

+0

@HemaSundar確かに、上記の私の答えです。私はあなたが求めているものが混乱しています。 – JeffC

関連する問題