Tag: selenium ide

Selenium – 如何计算表中的行数?

我有一个行数为“n”的表。 我需要数数,怎么办? 示例: – 我的表格如下所示。 Type Balance Date received Date returned Payment method Amount General Default 10/01/2013 08:53:20 Cash $ 10.00 HTML of my table looks like this. is table title row and are the entries done by the user. Everytime the user add the new entry, the count will increase and display a message […]

设置selenium webdriver的默认执行速度

我正在用webdriver运行一些GUI测试。 我直接从selenium IDE导出了一些测试。 在这个测试中,由于加载了下拉,我不得不降低IDE的运行速度。 如何在Selenium webdriver中减慢测试速度? 我已经把 driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS); 它一直在快速运行。 我知道睡眠选项,但这不是我想要的,我想改变webdriver的默认执行速度。 这是我的代码: import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.util.concurrent.TimeUnit; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.NoAlertPresentException; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class ProfileCheck { private WebDriver driver; private String baseUrl; private boolean acceptNextAlert = […]

在Selenium Webdriver中,在性能Linktext或css方面哪个更好?

在Selenium ,最好使用Locator ID定位元素。 最小的定位器是XPath (如果我错了,请纠正我)。 那么一个人应该使用Locators来确定element优先级或顺序是什么?

Java和Selenium用于填写Web表单?

我想自动填写网络表单。 我使用Selenium IDE创建一个脚本,该脚本使用一个命令来搜索网页中的指定文本。 我想根据这篇文章采取行动。 如果text = congratulations,则发送电子邮件到某个地址。 如果没有,则单击“确定”按钮。 我不认为Selenium IDE可以做这个If-else逻辑并自己发送邮件( 在selenium ide中使用if / else )。 所以,我想到使用Java代码“运行”这个Selenium HTML脚本,找出是否找到了所需的文本 – 如果是,则发送邮件; 否则Java代码将“单击”确定按钮。 这种方法有意义吗? 是否可以使用Java和某种Selenium Java API来实现这一点?

Selenium WebDriver with Java:无法接受警报

在selenium IDE中录制时,我可以在弹出窗口中单击“确定”按钮,并希望能够使用它来单击它 driver.findElement(By.linkText(“OK”)).click(); 但事实并非如此。 同样,这不起作用。 driver.switchTo().alert().accept(); Selenium会抛出NoAlertPresentexception。 如果弹出的不是警报,那么它是什么? 我如何点击“是”!

Selenium web驱动程序:无法滚动到视图中

我在eclipse中使用Selenium IDE和Selenium web驱动程序testng我的测试是针对ZK应用程序的.. 测试用例在Selenium IDE上运行良好.. work it2 work it2 open /xxx click //li[2]/div/div/div/span pause 3000 3000 doubleClick //div[2]/div[2] pause 3000 3000 但是当我使用selenium web driver(testng)在eclipse中运行它时,我收到了一个错误.. selenium.open(“xxx”); selenium.click(“//li[2]/div/div/div/span”); Thread.sleep(3000); selenium.doubleClick(“//div[2]/div[2]”); Thread.sleep(3000); 我还将代码更改为 driver.get(“xxx”); driver.findElement(By.xpath(“//li[2]/div/div/div/span”)).click(); Thread.sleep(3000); WebElement ee = driver.findElement(By.xpath(“//div[2]/div[2]”)); Actions action = new Actions(driver); action.doubleClick(ee).perform(); Thread.sleep(3000); 也得到同样的错误…… 错误就在这一行 //div[2]/div[2] com.thoughtworks.selenium.SeleniumException:元素内的偏移量无法滚动到视图中:(87,118):[object XrayWrapper [object HTMLDivElement]]命令持续时间或超时:63毫秒构建信息:版本:’2.39.0’,修订版:’ff23eac’,时间:’2013-12-16 16:11:15’系统信息:主机:’EnD’,ip:’192.168.17.76’,os.name:’Windows 7’,os.arch:’ amd64’,os.version:’6.1’,java.version:’1.7.0_51’会话ID:3b79783c-2558-4c87-bd51-a72821696040驱动程序信息:org.openqa.selenium.firefox.FirefoxDriverfunction[{platform = […]

如何将selenium IDE中记录的命令转换为Java?

是否有任何应用程序或简单方法将Selenium IDE记录的所有命令转换为Java (Selenium WebDriver) ? 这将更容易,并将节省大量时间。 任何建议将不胜感激。 谢谢!