小编Sun*_*ali的帖子

当帧没有id时,如何识别并切换到selenium webdriver中的帧

任何人都可以告诉我如何识别并切换到只有标题的iframe?

<iframe frameborder="0" style="border: 0px none; width: 100%; height: 356px; min-width: 0px; min-height: 0px; overflow: auto;" dojoattachpoint="frame" title="Fill Quote" src="https://tssstrpms501.corp.trelleborg.com:12001/teamworks/process.lsw?zWorkflowState=1&zTaskId=4581&zResetContext=true&coachDebugTrace=none">
Run Code Online (Sandbox Code Playgroud)

我试过下面的代码,但它不起作用

driver.switchTo().frame(driver.findElement(By.tagName("iframe")));
Run Code Online (Sandbox Code Playgroud)

testing selenium selenium-webdriver

26
推荐指数
2
解决办法
15万
查看次数

这是WebDriver服务器的初始启动页面

相同的代码在firefox中运行,但它没有在IE9中执行并显示字符串消息"这是WebDriver服务器的初始启动页面".而其他人没有发现任何错误

        public void setUp() throws Exception {

    File file = new File("C:/Users/Sunil.Wali/Desktop/Softwares/IEDriverServer_Win32_2.37.0/IEDriverServer.exe");
    System.setProperty("webdriver.ie.driver", file.getAbsolutePath());

    driver = new InternetExplorerDriver();
    // driver = new FirefoxDriver();

    baseUrl = "https://tssstrpms501.corp.trelleborg.com:12001";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
      @Test
public void testLogin() throws Exception {
    driver.get(baseUrl + "/ProcessPortal/login.jsp");
    driver.findElement(By.id("username")).clear();
    driver.findElement(By.id("username")).sendKeys("sunil.wali");
    driver.findElement(By.id("password")).clear();
    driver.findElement(By.id("password")).sendKeys("Trelleborg@123");
    driver.findElement(By.id("log_in")).click();
    driver.findElement(By.id("processPortalUserDropdown")).click();
    driver.findElement(By.id("dijit_MenuItem_56_text")).click();
}

@After
public void tearDown() throws Exception {
    driver.quit();
    String verificationErrorString = verificationErrors.toString();
    if (!"".equals(verificationErrorString)) {
        fail(verificationErrorString);
    }
}
Run Code Online (Sandbox Code Playgroud)

输出: - 启动InternetExplorerDriver服务器(32位)2.37.0.0侦听端口31651

testng selenium selenium-webdriver

5
推荐指数
2
解决办法
3万
查看次数

等待“加载”图标从页面上消失

我们正在为 Web 应用程序做自动化,大多数情况下获取加载图标都会出现在页面中央.. 我们需要等待加载图标出现

<div id="loading" style="display: none; visibility: hidden;">
<div></div>
<div></div> 
Run Code Online (Sandbox Code Playgroud)

示例:我们在大多数情况下都有搜索功能,我们正在获取此加载图标。

我们正在使用的 selenium webdriver:我们要完成加载的 id 是 id="loading".. 请任何人为我面临的上述问题提供解决方案。

我们有不同的功能,如点击和发送键

selenium webdriver selenium-webdriver

4
推荐指数
1
解决办法
2万
查看次数