简体   繁体   English

如何在弹出窗口中填写表格

[英]How to fill The form in a popup

I'am trying to automate http://rose.99ats.com/careers.aspx 我正在尝试自动化http://rose.99ats.com/careers.aspx

After clicking on "signup", I couldn't find the element Popup. 单击“注册”后,我找不到元素Popup。 I used getWindowHandle() , also used driver.swithchto() , but getting error. 我使用了getWindowHandle() ,也使用了driver.swithchto() ,但是出错了。 I can't find element. 我找不到元素。

Because it's in a new iframe , you need to use driver.switchTo().frame() . 由于它位于新的iframe ,因此您需要使用driver.switchTo().frame()

Here is a detailed answer on using switchTo() , in which you can't use name/id in your case, index should generally be avoided, so you may try locate the iframe element by css selector or xpath first, then switch to this WebElement . 是有关使用switchTo()的详细答案,在这种情况下,您不能使用name / id,通常应避免使用索引,因此您可以先尝试通过css选择器或xpath定位iframe元素,然后再切换到该位置WebElement

WebElement popup = driver.findElement(By.cssSelector("iframe[src^='CareerSignUp.aspx']"));
driver.switchTo().frame(popup);
// or by index: driver.switchTo().frame(0);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM