selenium webdriver无法识别iframe中的对象

selenium webdriver无法识别iframe中的对象,iframe,webdriver,Iframe,Webdriver,我编写了一个代码,用于切换到框架并将一些值发送到文本框。在编写代码时,它对我很有用。现在,它正在识别对象,而不是传递值。请让我知道它失败的原因 Getobject方法使用xpath查找元素,xpath存储在属性文件中 getobject("ForgotClaimNumber_Link").click(); driver.switchTo().frame(driver.findElement(By.id("fancybox-frame"))); WebDriverWait wait = new W

我编写了一个代码,用于切换到框架并将一些值发送到文本框。在编写代码时,它对我很有用。现在,它正在识别对象,而不是传递值。请让我知道它失败的原因

Getobject方法使用xpath查找元素,xpath存储在属性文件中

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();

我认为您需要先切换到帧,然后才能向其发送其他命令。不要认为可以切换到帧,然后在一个命令中使用find元素。您需要知道帧名称或id。一旦知道可以执行操作。当您完成对框架的操作后,您需要返回主窗口(退出框架)

driver.switchTo().frame(“在此处输入ID或名称”); 驱动程序文件(由id(“id”))

getobject(“ClaimNumber_Edit”).sendKeys(“520098863”);getobject(“查找按钮”)。单击();“ClaimNumber\u Edit”和“Find\u Button”看起来不像XPath。你有没有试过和一个好的老司机,findElementBy??