I wanna to edit the "max" number editbox in this url which is present inside the iframe. I have successfully switched to that frame and can able to access other element. But access that "max" element to perform click/sendkeys operation on it.

driver.get("https://www.random.org/");
driver.switchTo().frame(0);                 
Thread.sleep(2000);
// Getting "No such Element for below element in an iframe"
WebElement max = driver.findElement(By.id("bwsekhhlzrbtobdigvhwbhwdmugydupfpgkorlni-max"));
max.click();
max.clear();
max.sendKeys("1000000");
//But I can able to access the below element which is also an iframe element
driver.findElement(By.cssSelector("input[value='Generate']")).click();
1

There are 1 best solutions below

0
Harshavardhan Konakanchi On

The id on input keeps on changing. Use this locator

//label[text()='Max:']/following-sibling::input