我已经使用Selenium2 / WebDriver编写了testing,并且想要testingHTTP请求是否返回HTTP 403 Forbidden。 使用Selenium WebDriver可以获得HTTP响应状态码吗?
有没有可能用seleniumtesting工具上传网页图片? 我正在使用python。 我尝试了很多东西,但没有任何工作。 我很绝望。 上传看起来像这样: http://img21.imageshack.us/img21/1954/uploadgr.jpg 感谢您的帮助 菲利普。
我正在将selenium1代码转换为selenium2,无法find任何简单的方法来select下拉菜单中的标签或获取下拉选定的值。 你知道在Selenium 2中怎么做? 以下是在Selenium 1中工作的两个声明,但不是在2中: browser.select("//path_to_drop_down", "Value1"); browser.getSelectedValue("//path_to_drop_down");
任何人都可以让我如何使selenium等待页面加载完成的时间? 我想要一些通用的东西,我知道我可以configurationWebDriverWait并调用类似于“find”的方法来让它等待,但是我不会走得太远。 我只需要testing页面加载成功,并进入下一页testing。 我在.net中发现了一些东西,但无法使其在Java中工作… IWait<IWebDriver> wait = new OpenQA.Selenium.Support.UI.WebDriverWait(driver, TimeSpan.FromSeconds(30.00)); wait.Until(driver1 => ((IJavaScriptExecutor)driver).ExecuteScript("return document.readyState").Equals("complete")); 任何想法的人?
我使用Selenium RC来自动执行一些浏览器操作,但我希望浏览器不可见。 这可能吗? 怎么样? selenium网格呢? 我可以隐藏Selenium RC窗口吗?
我用明确的等待,我有警告: org.openqa.selenium.WebDriverException:元素在点(36,72)处不可点击。 其他元素将收到点击:…命令持续时间或超时:393毫秒 如果我使用Thread.sleep(2000)我不会收到任何警告。 @Test(dataProvider = "menuData") public void Main(String btnMenu, String TitleResultPage, String Text) throws InterruptedException { WebDriverWait wait = new WebDriverWait(driver, 10); driver.findElement(By.id("navigationPageButton")).click(); try { wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector(btnMenu))); } catch (Exception e) { System.out.println("Oh"); } driver.findElement(By.cssSelector(btnMenu)).click(); Assert.assertEquals(driver.findElement(By.cssSelector(TitleResultPage)).getText(), Text); }
根据以前的问题,我将Selenium更新到了2.0.1版。但是现在我又遇到了另一个错误,即使configuration文件存在于/tmp/webdriver-py-profilecopy : 文件“/home/sultan/Repository/Django/monitor/app/request.py”,第236行,执行 浏览器= Firefox(个人资料) 文件“/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py”,第46行,在__init__ self.binary,超时), 文件“/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/extension_connection.py”,第46行,在__init__ self.binary.launch_browser(self.profile) 文件“/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py”,第44行,在launch_browser self._wait_until_connectable() 文件“/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py”,第87行,在_wait_until_connectable 引发WebDriverException(“无法加载configuration文件。configuration文件目录:%s”%self.profile.path) selenium.common.exceptions.WebDriverException:无法加载configuration文件。 configuration文件目录:/ tmp / webdriver-py-profilecopy 哪里不对? 我该如何解决这个问题?
有没有办法如何testing一个元素是否存在? 任何findElement方法都将以一个exception结束,但这不是我想要的,因为它可能是一个元素不存在,那没关系,这不是testing的失败,所以一个exception不可能是解决scheme。 我发现这个职位: Selenium c#Webdriver:等待元素存在但是,这是为C#,我不是很擅长。 任何人都可以将代码翻译成Java? 我很抱歉,我在Eclipse中尝试过,但是我没有把它写入Java代码。 这是代码: public static class WebDriverExtensions{ public static IWebElement FindElement(this IWebDriver driver, By by, int timeoutInSeconds){ if (timeoutInSeconds > 0){ var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeoutInSeconds)); return wait.Until(drv => drv.FindElement(by)); } return driver.FindElement(by); } }
我正在写一个Seleniumtesting用例。 这里是我用来匹配数据表中所有“修改”button的xpathexpression式。 //img[@title='Modify'] 我的问题是,如何通过索引访问匹配的节点集? 我试过了 //img[@title='Modify'][i] 和 //img[@title='Modify' and position() = i] 但都没有工作..我也尝试过XPath检查器(一个Firefox扩展)。 总共find13个匹配,然后我完全不知道如何select其中一个。 或者XPath支持指定不在同一父节点下的节点的select?
我试过这个 WebDriver driver = new ChromeDriver(); 但我得到的错误 失败的testing:setUp(com.TEST):驱动程序可执行文件的path必须由webdriver.chrome.driver系统属性设置; 有关更多信息,请参阅http://code.google.com/p/selenium/wiki/ChromeDriver 。 最新版本可以从http://code.google.com/p/chromedriver/downloads/list下载 我如何让Chrome来testingSelenium-WebDrivertesting用例?