Tag: selenium webdriver

Selenium Webdriver,在div弹出窗口内滚动

显示一个弹出窗口,其内容很大,必须滚动才能完全查看。 是否有滚动div中显示为弹出窗口的内容。 我们可以使用JavaScriptExecutor滚动到Element,但这似乎只能在窗口级别工作,但不能在div级别工作。

Selenium WebDriver选择combobox项目?

我们正在使用Selenium WebDriver和JBehave在我们的网络应用程序上运行“集成”测试。 我有一个方法将值输入表单输入。 @When(“I enter $elementId value $value”) public void enterElementText(final String elementId, final String value) { final WebElement webElement = webdriver.findElement(By.id(elementId)); webElement.clear(); webElement.sendKeys(value); } 但是,当我尝试使用它来选择下拉列表中的项目时(不出所料)会失败 java.lang.UnsupportedOperationException:您只能设置作为输入元素的元素的值 如何在组合中选择一个值?

SessionNotFoundException:会话ID为空。 调用quit()后使用WebDriver? (selenium)

我正在尝试使用Cucumber / Java编写一些selenium自动UI测试。 如果我的function文件中只有一个测试,一切正常。 但是如果我添加第二个测试,我会在driver.get()上收到此错误: org.openqa.selenium.remote.SessionNotFoundException: Session ID is null. Using WebDriver after calling quit()? Build info: version: ‘2.51.0’, revision: ‘1af067dbcaedd7d2ab9af5151fc471d363d97193’, time: ‘2016-02-05 11:20:57’ 基本上,我在一个包中初始化InitializeWebdriver类上的webdriver变量,然后在其他(步骤定义)类中引用它。 我确实将下面列出的步骤定义作为InitializeWebdriver类的一部分,并且它工作正常(直到移到另一个类中的不同步骤。所以我将该步骤移动到CommonSteps.java文件以查看它是否然后它会失败,它就会失败。所以现在我只是卡住了。我想在if (driver.equals(null))中做一个if (driver.equals(null))并且如果已经初始化那么做一个不同的动作,但我不知道我知道其他行动会是什么。 这是我的代码: tests.feature Feature: Two tests Background: Given I navigate to “http://www.google.com” Scenario: Test one When something happens Scenario: Test two When something else happens InitializeWebDriver.java public class […]

Selenium WebDriver是否支持Safari?

我正在使用Selenium WebDriver和Java。 我想使用Safari浏览器。 Selenium WebDriver是否支持Safari ?

‘Selenium-server-standalone.jar’和’Selenium Client&WebDriver’有什么区别?

‘Selenium-server-standalone.jar’和’Selenium Client&WebDriver’之间的实现差异是什么? 以下是SeleniumHQ.org网站[ http://www.seleniumhq.org/download/]的链接.. http://selenium-release.storage.googleapis.com/2.44/selenium-server-standalone-2.44.0.jar “ http://selenium-release.storage.googleapis.com/2.44/selenium-java-2.44.0.zip ” 我知道第一个是以前称为Selenium RC,第二个是Selenium 2.0(Webdriver)。 但最新版本是否支持Selenium Server中Webdriver中的所有jar。 我只有Selenium Server可用,Selenium Webdriver中的所有方法都支持Selenium Server吗? 同样,它们之间的区别有什么不同? 可以帮助 /谢谢

在Selenium WebDriver中区分b / w getText()和getAttribute()?

两者都用于获取标签之间的WebElement值? 请更新我的假设是否正确。 如果错了请详细说明。

jquery.show和WebDriverException之后的元素:未知错误:无法聚焦元素

我的javascript行: $(‘#name’).show(); 我的webdriver代码行: wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(“name”))).sendKeys(“Some Name”); 当我运行测试时,它会抛出以下exception: WebDriverException: unknown error: cannot focus element 所以,我一直在寻找解决方案。 Chrome google代码网站报告了一些问题。 关于使用JavaScriptExecutor有很多建议。 但它对我来说似乎不是一个更好的解决方案,因为它可以创建一个依赖于浏览器的代码。

WebDriver:如何检查页面对象Web元素是否存在?

使用带有webdriver的页面对象时,如何检查元素是否存在。 到目前为止,我这样做。 DefaultPage defaultPage = PageFactory.initElements(this.driver, DefaultPage.class); assertTrue(defaultPage.isUserCreateMenuLinkPresent()); 页面对象: public class DefaultPage { @FindBy(id = “link_i_user_create”) private WebElement userCreateMenuLink; public boolean isUserCreateMenuLinkPresent() { try { this.userCreateMenuLink.getTagName(); return true; } catch (NoSuchElementException e) { return false; } } } 但我无法相信这种尝试/捕获是人们应该这样做的方式。 那么什么是更好的方法来检查元素是否退出(使用页面对象)?

使用Selenium WebDriver和Java滚动

我正在使用Selenium WebDriver自动化我的浏览器测试。 我的浏览器标题是浮动的,无论浏览器滚动如何,它总是存在 。 因此,当我单击浏览器当前可见区域下方的某些元素时,selenium会尝试将元素滚动到视图中并单击它们。 但是由于自动滚动,因此元素在浮动标题后面滚动,当对它们执行任何操作时,页面标题中的元素被单击。 有没有办法限制WebDriver的默认滚动 ?

使用Selenium WebDriver和java检查该元素不存在的最佳方法

我尝试下面的代码,但似乎它不起作用…有人能告诉我最好的方法吗? public void verifyThatCommentDeleted(final String text) throws Exception { new WebDriverWait(driver, 5).until(new ExpectedCondition() { @Override public Boolean apply(WebDriver input) { try { input.findElement(By.xpath(String.format( Locators.CHECK_TEXT_IN_FIRST_STATUS_BOX, text))); return false; } catch (NoSuchElementException e) { return true; } } }); }