フレームを含むウェブサイト(ただし、トップウィンドウに表示されています)に要素(「791」を含む)を配置しようとしています。なんらかの理由で、Seleniumは要素を見つけることができません。それを見つける正しい方法は何ですか? ありがとう!Seleniumを使ってフレームを持つウェブサイト上の要素を見つける方法は?
public class StarOnline {
static WebDriver driver;
static String baseUrl;
public static void main(String[] args) throws InterruptedException {
baseUrl = "https://www.staronline.org.uk/demo_register.asp";
System.setProperty("webdriver.chrome.driver", "C:\\Automation\\libs\\Drivers\\chromedriver.exe");
driver = new ChromeDriver();
driver.get(baseUrl);
List<WebElement> checkbox = driver.findElements(By.className(".frm"));
System.out.println("list size = " + checkbox.size());
for (WebElement ell:checkbox)
{
if (ell.getText().contains("791"))
ell.click();
else System.out.println("Element not found");
break;
}
提供したURLのテキスト「791」を含む要素を私にアップデートできますか? – DebanjanB