- 浏览: 310989 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
yan372397390:
请问这几行命令是在哪里输入的
Genymotion模拟器安装Genymotion-ARM-Translation变copy的解决办法 -
littlevine:
...
"WebDriverException: Cannot find firefox binary in PATH."的解决方法 -
jujis008:
楼主, 这selenium用的是jdk自带的log,所以在% ...
PhantomJSDriver怎么设置在console里不输出运行信息 -
qi_ling2005:
OnTheRoad_lee 写道 String[] phant ...
PhantomJSDriver怎么设置在console里不输出运行信息 -
OnTheRoad_lee:
String[] phantomArgs = new Str ...
PhantomJSDriver怎么设置在console里不输出运行信息
最近想总结一下学习selenium webdriver的情况,于是就想用selenium webdriver里面的方法来实现selenium RC中操作的一些方法。目前封装了一个ActionDriverHelper类,来实现RC中Selenium.java和DefaultSelenium.java中的方法。有一些方法还没有实现,写的方法大多没有经过测试,仅供参考。代码如下:
package core; import java.io.File; import java.io.IOException; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; import org.apache.commons.io.FileUtils; import org.openqa.selenium.By; import org.openqa.selenium.Cookie; import org.openqa.selenium.Dimension; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Keys; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.OutputType; import org.openqa.selenium.Point; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.WebDriver.Timeouts; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.Select; public class ActionDriverHelper { protected WebDriver driver; public ActionDriverHelper(WebDriver driver){ this.driver = driver ; } public void click(By by) { driver.findElement(by).click(); } public void doubleClick(By by){ new Actions(driver).doubleClick(driver.findElement(by)).perform(); } public void contextMenu(By by) { new Actions(driver).contextClick(driver.findElement(by)).perform(); } public void clickAt(By by,String coordString) { int index = coordString.trim().indexOf(','); int xOffset = Integer.parseInt(coordString.trim().substring(0, index)); int yOffset = Integer.parseInt(coordString.trim().substring(index+1)); new Actions(driver).moveToElement(driver.findElement(by), xOffset, yOffset).click().perform(); } public void doubleClickAt(By by,String coordString){ int index = coordString.trim().indexOf(','); int xOffset = Integer.parseInt(coordString.trim().substring(0, index)); int yOffset = Integer.parseInt(coordString.trim().substring(index+1)); new Actions(driver).moveToElement(driver.findElement(by), xOffset, yOffset) .doubleClick(driver.findElement(by)) .perform(); } public void contextMenuAt(By by,String coordString) { int index = coordString.trim().indexOf(','); int xOffset = Integer.parseInt(coordString.trim().substring(0, index)); int yOffset = Integer.parseInt(coordString.trim().substring(index+1)); new Actions(driver).moveToElement(driver.findElement(by), xOffset, yOffset) .contextClick(driver.findElement(by)) .perform(); } public void fireEvent(By by,String eventName) { System.out.println("webdriver 不建议使用这样的方法,所以没有实现。"); } public void focus(By by) { System.out.println("webdriver 不建议使用这样的方法,所以没有实现。"); } public void keyPress(By by,Keys theKey) { new Actions(driver).keyDown(driver.findElement(by), theKey).release().perform(); } public void shiftKeyDown() { new Actions(driver).keyDown(Keys.SHIFT).perform(); } public void shiftKeyUp() { new Actions(driver).keyUp(Keys.SHIFT).perform(); } public void metaKeyDown() { new Actions(driver).keyDown(Keys.META).perform(); } public void metaKeyUp() { new Actions(driver).keyUp(Keys.META).perform(); } public void altKeyDown() { new Actions(driver).keyDown(Keys.ALT).perform(); } public void altKeyUp() { new Actions(driver).keyUp(Keys.ALT).perform(); } public void controlKeyDown() { new Actions(driver).keyDown(Keys.CONTROL).perform(); } public void controlKeyUp() { new Actions(driver).keyUp(Keys.CONTROL).perform(); } public void KeyDown(Keys theKey) { new Actions(driver).keyDown(theKey).perform(); } public void KeyDown(By by,Keys theKey){ new Actions(driver).keyDown(driver.findElement(by), theKey).perform(); } public void KeyUp(Keys theKey){ new Actions(driver).keyUp(theKey).perform(); } public void KeyUp(By by,Keys theKey){ new Actions(driver).keyUp(driver.findElement(by), theKey).perform(); } public void mouseOver(By by) { new Actions(driver).moveToElement(driver.findElement(by)).perform(); } public void mouseOut(By by) { System.out.println("没有实现!"); //new Actions(driver).moveToElement((driver.findElement(by)), -10, -10).perform(); } public void mouseDown(By by) { new Actions(driver).clickAndHold(driver.findElement(by)).perform(); } public void mouseDownRight(By by) { System.out.println("没有实现!"); } public void mouseDownAt(By by,String coordString) { System.out.println("没有实现!"); } public void mouseDownRightAt(By by,String coordString) { System.out.println("没有实现!"); } public void mouseUp(By by) { System.out.println("没有实现!"); } public void mouseUpRight(By by) { System.out.println("没有实现!"); } public void mouseUpAt(By by,String coordString) { System.out.println("没有实现!"); } public void mouseUpRightAt(By by,String coordString) { System.out.println("没有实现!"); } public void mouseMove(By by) { new Actions(driver).moveToElement(driver.findElement(by)).perform(); } public void mouseMoveAt(By by,String coordString) { int index = coordString.trim().indexOf(','); int xOffset = Integer.parseInt(coordString.trim().substring(0, index)); int yOffset = Integer.parseInt(coordString.trim().substring(index+1)); new Actions(driver).moveToElement(driver.findElement(by),xOffset,yOffset).perform(); } public void type(By by, String testdata) { driver.findElement(by).clear(); driver.findElement(by).sendKeys(testdata); } public void typeKeys(By by, Keys key) { driver.findElement(by).sendKeys(key); } public void setSpeed(String value) { System.out.println("The methods to set the execution speed in WebDriver were deprecated"); } public String getSpeed() { System.out.println("The methods to set the execution speed in WebDriver were deprecated"); return null; } public void check(By by) { if(!isChecked(by)) click(by); } public void uncheck(By by) { if(isChecked(by)) click(by); } public void select(By by,String optionValue) { new Select(driver.findElement(by)).selectByValue(optionValue); } public void select(By by,int index) { new Select(driver.findElement(by)).selectByIndex(index); } public void addSelection(By by,String optionValue) { select(by,optionValue); } public void addSelection(By by,int index) { select(by,index); } public void removeSelection(By by,String value) { new Select(driver.findElement(by)).deselectByValue(value); } public void removeSelection(By by,int index) { new Select(driver.findElement(by)).deselectByIndex(index); } public void removeAllSelections(By by) { new Select(driver.findElement(by)).deselectAll(); } public void submit(By by) { driver.findElement(by).submit(); } public void open(String url) { driver.get(url); } public void openWindow(String url,String handler) { System.out.println("方法没有实现!"); } public void selectWindow(String handler) { driver.switchTo().window(handler); } public String getCurrentHandler(){ String currentHandler = driver.getWindowHandle(); return currentHandler; } public String getSecondWindowHandler(){ Set<String> handlers = driver.getWindowHandles(); String reHandler = getCurrentHandler(); for(String handler : handlers){ if(reHandler.equals(handler)) continue; reHandler = handler; } return reHandler; } public void selectPopUp(String handler) { driver.switchTo().window(handler); } public void selectPopUp() { driver.switchTo().window(getSecondWindowHandler()); } public void deselectPopUp() { driver.switchTo().window(getCurrentHandler()); } public void selectFrame(int index) { driver.switchTo().frame(index); } public void selectFrame(String str) { driver.switchTo().frame(str); } public void selectFrame(By by) { driver.switchTo().frame(driver.findElement(by)); } public void waitForPopUp(String windowID,String timeout) { System.out.println("没有实现"); } public void accept(){ driver.switchTo().alert().accept(); } public void dismiss(){ driver.switchTo().alert().dismiss(); } public void chooseCancelOnNextConfirmation() { driver.switchTo().alert().dismiss(); } public void chooseOkOnNextConfirmation() { driver.switchTo().alert().accept(); } public void answerOnNextPrompt(String answer) { driver.switchTo().alert().sendKeys(answer); } public void goBack() { driver.navigate().back(); } public void refresh() { driver.navigate().refresh(); } public void forward() { driver.navigate().forward(); } public void to(String urlStr){ driver.navigate().to(urlStr); } public void close() { driver.close(); } public boolean isAlertPresent() { Boolean b = true; try{ driver.switchTo().alert(); }catch(Exception e){ b = false; } return b; } public boolean isPromptPresent() { return isAlertPresent(); } public boolean isConfirmationPresent() { return isAlertPresent(); } public String getAlert() { return driver.switchTo().alert().getText(); } public String getConfirmation() { return getAlert(); } public String getPrompt() { return getAlert(); } public String getLocation() { return driver.getCurrentUrl(); } public String getTitle(){ return driver.getTitle(); } public String getBodyText() { String str = ""; List<WebElement> elements = driver.findElements(By.xpath("//body//*[contains(text(),*)]")); for(WebElement e : elements){ str += e.getText()+" "; } return str; } public String getValue(By by) { return driver.findElement(by).getAttribute("value"); } public String getText(By by) { return driver.findElement(by).getText(); } public void highlight(By by) { WebElement element = driver.findElement(by); ((JavascriptExecutor)driver).executeScript("arguments[0].style.border = \"5px solid yellow\"",element); } public Object getEval(String script,Object... args) { return ((JavascriptExecutor)driver).executeScript(script,args); } public Object getAsyncEval(String script,Object... args){ return ((JavascriptExecutor)driver).executeAsyncScript(script, args); } public boolean isChecked(By by) { return driver.findElement(by).isSelected(); } public String getTable(By by,String tableCellAddress) { WebElement table = driver.findElement(by); int index = tableCellAddress.trim().indexOf('.'); int row = Integer.parseInt(tableCellAddress.substring(0, index)); int cell = Integer.parseInt(tableCellAddress.substring(index+1)); List<WebElement> rows = table.findElements(By.tagName("tr")); WebElement theRow = rows.get(row); String text = getCell(theRow, cell); return text; } private String getCell(WebElement Row,int cell){ List<WebElement> cells; String text = null; if(Row.findElements(By.tagName("th")).size()>0){ cells = Row.findElements(By.tagName("th")); text = cells.get(cell).getText(); } if(Row.findElements(By.tagName("td")).size()>0){ cells = Row.findElements(By.tagName("td")); text = cells.get(cell).getText(); } return text; } public String[] getSelectedLabels(By by) { Set<String> set = new HashSet<String>(); List<WebElement> selectedOptions = new Select(driver.findElement(by)) .getAllSelectedOptions(); for(WebElement e : selectedOptions){ set.add(e.getText()); } return set.toArray(new String[set.size()]); } public String getSelectedLabel(By by) { return getSelectedOption(by).getText(); } public String[] getSelectedValues(By by) { Set<String> set = new HashSet<String>(); List<WebElement> selectedOptions = new Select(driver.findElement(by)) .getAllSelectedOptions(); for(WebElement e : selectedOptions){ set.add(e.getAttribute("value")); } return set.toArray(new String[set.size()]); } public String getSelectedValue(By by) { return getSelectedOption(by).getAttribute("value"); } public String[] getSelectedIndexes(By by) { Set<String> set = new HashSet<String>(); List<WebElement> selectedOptions = new Select(driver.findElement(by)) .getAllSelectedOptions(); List<WebElement> options = new Select(driver.findElement(by)).getOptions(); for(WebElement e : selectedOptions){ set.add(String.valueOf(options.indexOf(e))); } return set.toArray(new String[set.size()]); } public String getSelectedIndex(By by) { List<WebElement> options = new Select(driver.findElement(by)).getOptions(); return String.valueOf(options.indexOf(getSelectedOption(by))); } public String[] getSelectedIds(By by) { Set<String> ids = new HashSet<String>(); List<WebElement> options = new Select(driver.findElement(by)).getOptions(); for(WebElement option : options){ if(option.isSelected()) { ids.add(option.getAttribute("id")) ; } } return ids.toArray(new String[ids.size()]); } public String getSelectedId(By by) { return getSelectedOption(by).getAttribute("id"); } private WebElement getSelectedOption(By by){ WebElement selectedOption = null; List<WebElement> options = new Select(driver.findElement(by)).getOptions(); for(WebElement option : options){ if(option.isSelected()) { selectedOption = option; } } return selectedOption; } public boolean isSomethingSelected(By by) { boolean b = false; List<WebElement> options = new Select(driver.findElement(by)).getOptions(); for(WebElement option : options){ if(option.isSelected()) { b = true ; break; } } return b; } public String[] getSelectOptions(By by) { Set<String> set = new HashSet<String>(); List<WebElement> options = new Select(driver.findElement(by)).getOptions(); for(WebElement e : options){ set.add(e.getText()); } return set.toArray(new String[set.size()]); } public String getAttribute(By by,String attributeLocator) { return driver.findElement(by).getAttribute(attributeLocator); } public boolean isTextPresent(String pattern) { String Xpath= "//*[contains(text(),\'"+pattern+"\')]" ; try { driver.findElement(By.xpath(Xpath)); return true; } catch (NoSuchElementException e) { return false; } } public boolean isElementPresent(By by) { return driver.findElements(by).size() > 0; } public boolean isVisible(By by) { return driver.findElement(by).isDisplayed(); } public boolean isEditable(By by) { return driver.findElement(by).isEnabled(); } public List<WebElement> getAllButtons() { return driver.findElements(By.xpath("//input[@type='button']")); } public List<WebElement> getAllLinks() { return driver.findElements(By.tagName("a")); } public List<WebElement> getAllFields() { return driver.findElements(By.xpath("//input[@type='text']")); } public String[] getAttributeFromAllWindows(String attributeName) { System.out.println("不知道怎么实现"); return null; } public void dragdrop(By by,String movementsString) { dragAndDrop(by, movementsString); } public void dragAndDrop(By by,String movementsString) { int index = movementsString.trim().indexOf('.'); int xOffset = Integer.parseInt(movementsString.substring(0, index)); int yOffset = Integer.parseInt(movementsString.substring(index+1)); new Actions(driver).clickAndHold(driver.findElement(by)).moveByOffset(xOffset, yOffset).perform(); } public void setMouseSpeed(String pixels) { System.out.println("不支持"); } public Number getMouseSpeed() { System.out.println("不支持"); return null; } public void dragAndDropToObject(By source,By target) { new Actions(driver).dragAndDrop(driver.findElement(source), driver.findElement(target)).perform(); } public void windowFocus() { driver.switchTo().defaultContent(); } public void windowMaximize() { driver.manage().window().setPosition(new Point(0,0)); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); Dimension dim = new Dimension((int) screenSize.getWidth(), (int) screenSize.getHeight()); driver.manage().window().setSize(dim); } public String[] getAllWindowIds() { System.out.println("不能实现!"); return null; } public String[] getAllWindowNames() { System.out.println("不能实现!"); return null; } public String[] getAllWindowTitles() { Set<String> handles = driver.getWindowHandles(); Set<String> titles = new HashSet<String>(); for(String handle : handles){ titles.add(driver.switchTo().window(handle).getTitle()); } return titles.toArray(new String[titles.size()]); } public String getHtmlSource() { return driver.getPageSource(); } public void setCursorPosition(String locator,String position) { System.out.println("没能实现!"); } public Number getElementIndex(String locator) { System.out.println("没能实现!"); return null; } public Object isOrdered(By by1,By by2) { System.out.println("没能实现!"); return null; } public Number getElementPositionLeft(By by) { return driver.findElement(by).getLocation().getX(); } public Number getElementPositionTop(By by) { return driver.findElement(by).getLocation().getY(); } public Number getElementWidth(By by) { return driver.findElement(by).getSize().getWidth(); } public Number getElementHeight(By by) { return driver.findElement(by).getSize().getHeight(); } public Number getCursorPosition(String locator) { System.out.println("没能实现!"); return null; } public String getExpression(String expression) { System.out.println("没能实现!"); return null; } public Number getXpathCount(By xpath) { return driver.findElements(xpath).size(); } public void assignId(By by,String identifier) { System.out.println("不想实现!"); } /*public void allowNativeXpath(String allow) { commandProcessor.doCommand("allowNativeXpath", new String[] {allow,}); }*/ /*public void ignoreAttributesWithoutValue(String ignore) { commandProcessor.doCommand("ignoreAttributesWithoutValue", new String[] {ignore,}); }*/ public void waitForCondition(String script,String timeout,Object... args) { Boolean b = false; int time = 0; while(time <= Integer.parseInt(timeout)){ b = (Boolean) ((JavascriptExecutor)driver).executeScript(script,args); if(b==true) break; try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } time += 1000; } } public void setTimeout(String timeout) { driver.manage().timeouts().implicitlyWait(Integer.parseInt(timeout), TimeUnit.SECONDS); } public void waitForPageToLoad(String timeout) { driver.manage().timeouts().pageLoadTimeout(Integer.parseInt(timeout), TimeUnit.SECONDS); } public void waitForFrameToLoad(String frameAddress,String timeout) { /*driver.switchTo().frame(frameAddress) .manage() .timeouts() .pageLoadTimeout(Integer.parseInt(timeout), TimeUnit.SECONDS);*/ } public String getCookie() { String cookies = ""; Set<Cookie> cookiesSet = driver.manage().getCookies(); for(Cookie c : cookiesSet){ cookies += c.getName()+"="+c.getValue()+";"; } return cookies; } public String getCookieByName(String name) { return driver.manage().getCookieNamed(name).getValue(); } public boolean isCookiePresent(String name) { boolean b = false ; if(driver.manage().getCookieNamed(name) != null || driver.manage().getCookieNamed(name).equals(null)) b = true; return b; } public void createCookie(Cookie c) { driver.manage().addCookie(c); } public void deleteCookie(Cookie c) { driver.manage().deleteCookie(c); } public void deleteAllVisibleCookies() { driver.manage().getCookieNamed("fs").isSecure(); } /*public void setBrowserLogLevel(String logLevel) { }*/ /*public void runScript(String script) { commandProcessor.doCommand("runScript", new String[] {script,}); }*/ /*public void addLocationStrategy(String strategyName,String functionDefinition) { commandProcessor.doCommand("addLocationStrategy", new String[] {strategyName,functionDefinition,}); }*/ public void captureEntirePageScreenshot(String filename) { File screenShotFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); try { FileUtils.copyFile(screenShotFile, new File(filename)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /*public void rollup(String rollupName,String kwargs) { commandProcessor.doCommand("rollup", new String[] {rollupName,kwargs,}); } public void addScript(String scriptContent,String scriptTagId) { commandProcessor.doCommand("addScript", new String[] {scriptContent,scriptTagId,}); } public void removeScript(String scriptTagId) { commandProcessor.doCommand("removeScript", new String[] {scriptTagId,}); } public void useXpathLibrary(String libraryName) { commandProcessor.doCommand("useXpathLibrary", new String[] {libraryName,}); } public void setContext(String context) { commandProcessor.doCommand("setContext", new String[] {context,}); }*/ /*public void attachFile(String fieldLocator,String fileLocator) { commandProcessor.doCommand("attachFile", new String[] {fieldLocator,fileLocator,}); }*/ /*public void captureScreenshot(String filename) { commandProcessor.doCommand("captureScreenshot", new String[] {filename,}); }*/ public String captureScreenshotToString() { String screen = ((TakesScreenshot)driver).getScreenshotAs(OutputType.BASE64); return screen; } /* public String captureNetworkTraffic(String type) { return commandProcessor.getString("captureNetworkTraffic", new String[] {type}); } */ /*public void addCustomRequestHeader(String key, String value) { commandProcessor.getString("addCustomRequestHeader", new String[] {key, value}); }*/ /*public String captureEntirePageScreenshotToString(String kwargs) { return commandProcessor.getString("captureEntirePageScreenshotToString", new String[] {kwargs,}); }*/ public void shutDown() { driver.quit(); } /*public String retrieveLastRemoteControlLogs() { return commandProcessor.getString("retrieveLastRemoteControlLogs", new String[] {}); }*/ public void keyDownNative(Keys keycode) { new Actions(driver).keyDown(keycode).perform(); } public void keyUpNative(Keys keycode) { new Actions(driver).keyUp(keycode).perform(); } public void keyPressNative(String keycode) { new Actions(driver).click().perform(); } public void waitForElementPresent(By by) { for(int i=0; i<60; i++) { if (isElementPresent(by)) { break; } else { try { driver.wait(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } } public void clickAndWaitForElementPresent(By by, By waitElement) { click(by); waitForElementPresent(waitElement); } public Boolean VeryTitle(String exception,String actual){ if(exception.equals(actual)) return true; else return false; } }
PS:有什么建议,欢迎评论,一起交流!
评论
2 楼
qi_ling2005
2012-12-12
a2602162453 写道
大师,真是有魄力,采用这种方式来总结!
1 楼
a2602162453
2012-10-25
大师,真是有魄力,采用这种方式来总结!
发表评论
-
selenium github doc
2015-07-21 16:26 1049selenium 官网被墙, 看不了doc, 可以去下面这个 ... -
selenium webdriver学习(二十二)------------XVFB实现selenium在linux上无界面运行安装篇
2015-03-12 12:25 13815selenium在linux上无界面 ... -
PhantomJSDriver怎么设置在console里不输出运行信息
2014-11-10 15:50 2349每次运行PhantomJSDriver都输出一堆的INFO、 ... -
selenium webdriver 常见问题
2012-07-10 18:31 0注我下面说到的webdriver就是指selenium web ... -
selenium和webdriver合并的原因
2012-07-04 10:48 3343selenium和webdriver合并的原因,传送门 -
selenium webdriver学习(二十一)------------Selenium Grid深入学习
2012-06-29 18:35 4817应网友要求写一个用Selenium Grid控制多系统多浏览器 ... -
selenium webdriver学习(二十)------------Selenium Grid
2012-06-27 18:37 5814Selenium Grid允许同时并行 ... -
selenium webdriver学习(十九)-------我们的构建文件CrazyFunBuild (译)
2012-06-14 10:50 2268原文:CrazyFunBuild ... -
selenium webdriver学习(十八)----------构建webdriver
2012-05-22 16:03 4346准备环境 对所有版 ... -
selenium webdriver学习(十七)----------把selenium项目同步到本地eclipse
2012-05-11 16:00 3967这里主要是想把selenium的整个项目同步到eclipse的 ... -
selenium webdriver学习(十五)------------如何处理FirefoxProfile
2012-04-10 18:29 9032这一节主要涉及 selenium webdriver处理Fir ... -
selenium webdriver学习(十四)------------如何处理table
2012-04-07 09:15 7425以前在selenium RC 里面有一个getTable方法, ... -
selenium webdriver学习(十三)------------如何利用Actions类模拟鼠标和键盘的操作
2012-03-29 12:36 12024在selenium webdriver学习(十)------- ... -
selenium webdriver学习(十二)------------如何利用selenium-webdriver截图
2012-03-26 16:29 5861在自动化测试中常常会用到截图功能。最近用了一下selenium ... -
学习selenium-webdriver一些网站
2012-03-20 16:49 0http://www.aosabook.org/en/sele ... -
selenium webdriver学习(十一)------------如何等待页面元素加载完成
2012-03-14 18:25 15456web的自动化测试中,我们经常会遇到这样一种情况:当我们的程 ... -
selenium webdriver学习(十)------------如何把一个元素拖放到另一个元素里面
2012-03-13 13:09 5891Q群里有时候会有人问,selenium webdriver怎 ... -
selenium webdriver学习(九)------------如何操作cookies
2012-03-12 17:45 5191Web 测试中我们经常会接触到Cookies,一个Cookie ... -
selenium webdriver学习(八)------------如何操作select下拉框
2012-03-12 16:06 10177下面我们来看一下selenium webdriver是如何来处 ... -
selenium webdriver学习(七)------------如何处理alert、confirm、prompt对话框
2012-03-12 14:08 10172alert、confirm、prompt这样的js对话框在se ...
相关推荐
在这个“ruby+selenium-webdriver测试--第一个例子源代码”中,我们将探讨如何使用Ruby和Selenium-Webdriver实现自动化测试的初步步骤。 首先,我们需要安装必要的库。确保已经安装了Ruby,并通过RubyGems来安装...
通过深入研究这个压缩包中的代码示例,学习者不仅可以理解Selenium WebDriver的工作原理,还能掌握如何在实际项目中应用这些知识,提升自动化测试的技能。同时,这也有助于理解和调试测试脚本,解决在自动化测试过程...
在本文档中,我们学习了如何使用 Python 和 Selenium WebDriver 实现自动化测试,学习了元素定位的多种方式,包括使用浏览器工具、findElement 方法、findElements 方法等,并了解了多种定位策略。这些技术将帮助...
在Ruby编程语言中,Selenium-Webdriver是一个强大的工具,用于进行自动化Web浏览器测试。它允许开发者编写脚本来模拟用户与网页的交互,从而验证应用的功能和行为。本篇文章将深入探讨如何使用Ruby和Selenium-...
1.1 selenium webdriver学习(一)------------快速开始 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2 selenium webdriver学习(二)————对浏览器的简单操作 . . . . . . ...
Selenium.WebDriver.4.0.0-alpha02.nupkg,Selenium.WebDriver 4.0,Selenium is a set of different software tools each with a different approach to supporting browser automation. These tools are highly ...
selenium-webdriver原创selenium-webdriver原创selenium-webdriver原创selenium-webdriver原创
安装selenium webdriver 安装ruby1.8.7或1.9.2。注意selenium-webdriver只支持1.8.7以上的ruby版本; 使用gem安装selenium-webdriver;打开命令行,输入下列代码完成安装。注意,如果你的开发环境需要http proxy...
本文档主要介绍了使用 Selenium+WebDriver 进行自动化测试的学习方法,从基础到精通的学习方法。下面我们将对标题、描述、标签和部分内容进行详细的解释。 标题:selenium+webdriver学习文档 这是一个学习文档,...
4. **简洁的API**:使用`webdriver_manager`只需几行代码即可实现WebDriver的管理,如`ChromeDriverManager().install()`,使得代码更简洁易读。 以下是如何在Python项目中使用`webdriver_manager`的示例: ```...
全书共分为四个部分:第1部分基础篇主要讲解自动化测试相关的基础理论、WebDriver 环境安装、单元测试工具的使用方法以及 WebDrvier的入门使用实例,第2部分实战应用篇基于丰富的实战案例讲解页面元素的定位方法以及...
【标题】"selenium webdriver+chrome插件.zip" 涉及的核心知识点是Selenium WebDriver,特别是它在Chrome浏览器中的应用以及与Firefox的交互。这个压缩包包含了Selenium IDE的Chrome插件,以及对应的WebDriver驱动...
Selenium WebDriver 是一款广泛使用的自动化测试工具,专为Web应用程序设计。它允许程序员模拟真实用户在浏览器中的操作,如点击、输入、导航等,从而进行功能性和兼容性测试。了解其工作原理对于优化自动化测试脚本...
**Selenium WebDriver API...综上所述,`selenium-API-2.12.chm`文档是学习和掌握Selenium WebDriver API的重要资源,它涵盖了从基本操作到高级特性的全面内容,对于任何进行Web自动化测试的人来说都是不可或缺的参考。
自动化测试:Selenium webdriver学习笔记 C#版 在本篇笔记中,我们将讨论 Selenium webdriver 的自动化测试中的对象定位方法。对象定位是自动化测试中非常重要的一步骤,它决定了我们的测试脚本是否能够正确地找到...
**Selenium WebDriver** 是一个广泛使用的自动化测试工具,主要用于网页应用程序的测试。它模拟了真实用户的浏览器行为,允许测试人员编写脚本来控制浏览器执行各种操作,如点击按钮、填写表单、导航等。WebDriver ...
selenium-webdriver-2.5.0.gem
ruby2.0.0+selenium-webdriver+watir-webdriver+rails离线备份,设置环境变量后可使用(未测试)