Object inside iframe not recognized by selenium webdriver

I wrote the code to switch to the frame and send some values ​​to the text box. when writing code, it worked for me. Now it now recognizes the object and does not pass the value. let me know why he fails.

The Getobject method finds an element using xpath, xpath is stored in the properties file.

getobject("ForgotClaimNumber_Link").click(); driver.switchTo().frame(driver.findElement(By.id("fancybox-frame"))); WebDriverWait wait = new WebDriverWait(driver,100); wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='txtClaimNum']"))); getobject("ClaimNumber_Edit").sendKeys("5200098863"); getobject("Find_Button").click(); 
+4
source share
1 answer

I think you need to switch to the frame first, then you can send other commands to it. Do not think that you can switch to a frame and then use the find element in one command. you need to know the frame name or id. As soon as you find out that you can perform actions. when you are done with the frame, you need to return to the main window (exit frame)

driver.switchTo (). frame ("enter identifier or name here"); driver.findElement (By.id ("ID"));

+4
source

All Articles