Fatin Shafiqah:
私はすでに、ウィンドウのポップアップでボタンをクリックすることができますので、ポップアップ表示ウィンドウに切り替え、私はラジオボタンの要素を見つけることができませんよ。
これは私のコードです:
driver.findElement(By.id("searchPrimIndustryImage")).click();
String mainWindow = driver.getWindowHandle();
Set<String> s1 = driver.getWindowHandles();
Iterator<String> i1 = s1.iterator();
while(i1.hasNext())
{
String popupWindow = i1.next();
if(!mainWindow.equalsIgnoreCase(popupWindow))
{
driver.switchTo().window(popupWindow);
driver.findElement(By.id("Image1")).click();
driver.findElement(By.xpath("//input[@value='28049']")).click();
driver.findElement(By.id("Image5")).click();
}
}
ラジオボタン要素は、XPathを有するものです。
メイトMRSE:
あなたは、XPathが正しく、要素がページ上で実際に存在していることを確認している場合、待機を使用してみてください。XPathの要素をクリックする前にこれを追加してみてください:
WebDriverWait wait = new WebDriverWait(driver,30);
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@value='28049']")));
あなたは輸入が必要になります
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.support.ui.ExpectedConditions;