摘要:Description:Need to turn page by operating scroll bar and find out the element in the current page.Previous page will not exist in DOM structure when ...
阅读全文
摘要://@author jzhang6 public void dragAndDropOffset(WebDriver driver,WebElement dragableEl, WebElement dropableEl, int offsetX, int offsetY){ Actions act...
阅读全文
摘要:等待元素出现之后再消失,界面上的loading icon都属于这种类型,之前的方法总是卡死,换这种方法目前还好用的/** * Check if the element present with customized timeout * @param driver * @par...
阅读全文
摘要:界面上如果有一个对话框可能弹出来,也可能不弹出,我们都要认为是正常,应该怎么处理呢?/** * check if release notes dialog present * @author j */ public boolean isReleaseNotesDialogPresent(){ ...
阅读全文
摘要:对不可见元素进行操作时,如果通过普通的方式不可行,可以尝试用Javascript Scroll hidden element into view Click hidden element Get text of hidden element
阅读全文
摘要:在升级Selenium的版本之前,写了一段拖拽的代码,Drag and Drop 都好使的, 但是,将Selenium的版本升级到2.45.0之后,图标拖拽可以成功,释放不生效。试了N多种解决方案都不管用,后来发现下面这种办法可行。一开始在界面可以看得见的,用来进行拖拽的图标是dragable的,在...
阅读全文
摘要:界面上有些元素是要先等它出现,再等它消失,譬如loading icon这个是等多个loading icon出现后消失/** * Wait for loading icon disappear in dialog and Widgets * @author jz */ public void w...
阅读全文
摘要:验证方法:将两次的Dom结构进行对比 String beforeStr = (String) SeleniumUtil.getInnerHTML(page.getDriver(), page.getDLGDataColumnSetting()); el.c...
阅读全文
摘要:5 different ways to refresh a webpage using Selenium Webdriver Here are the 5 different ways, using which we can refresh a webpage.There might be even...
阅读全文
摘要:隐藏元素无法通过gettext()获取其文本内容,须用javascript来获取String actualDataPointName = (String) ((JavascriptExecutor) driver).executeScript( "return jQuery(arguments...
阅读全文
摘要:Automation Smoke test Template8/11/2014Rachel LvRead Only 场景:需要找到Table中的某一行,然后找到这行的铅笔图标,点这个铅笔图标会出来下拉菜单,然后在下拉菜单中点击Open刚开始写脚本的时候,按照以往的方式会报这样的错误:"Element...
阅读全文
摘要:public void clickReportIcon(){ String initialWindowHandle = driver.getWindowHandle(); //保存原始的浏览器窗口 page.getReportIcon().click(); //这个操作之后将会弹出另外一个浏...
阅读全文
摘要:在自动化测试的过程中,经常会出现这样的场景:按住Ctrl的同时,进行单击操作,已达到多选的目的Actions a = new Actions(driver);a.keyDown(Keys.CONTROL).perform();for(int i = 0;i<quantity;i++){ W...
阅读全文
摘要:我在测试的过程中遇到一个这样的问题,我无法通过CssSelector找到iFrame下边的html:rrrrrrrt后来我发现只能找到iFrame这里,再往后就找不到了。我用过sendKeys to可以将Text发送给body,但是想通过Assert去验证iFrame的text,无法做到。解决办法:...
阅读全文
摘要:SeleniumUtil.jsClick(driver, saveButtonEl);
阅读全文
摘要:Alert alert = driver.switchTo().alert();alert.accept();
阅读全文
摘要:案例1:I am very thankful to saish and cbeust for the solution. I went through the similar issue with eclipse which got stuck at 57% when run in debug mo...
阅读全文
摘要:在 CSS 中,选择器是一种模式,用于选择需要添加样式的元素。"CSS" 列指示该属性是在哪个 CSS 版本中定义的。(CSS1、CSS2 还是 CSS3。)选择器例子例子描述CSS.class.intro选择 class="intro" 的所有元素。1#id#firstname选择 id="fir...
阅读全文
摘要:public void uploadLocalFileToServer(String uploadFileName){ String AutomationPath = System.getProperty("user.dir"); String filePath=AutomationPath+"...
阅读全文
摘要:显式等待 Explicit wait显示等待 , 就是明确的要等到某个元素出现或者某个元素满足某种条件,每隔一段时间检查一次,等不到,就一直等,如果在规定的时间内还没有找到,就跳出来检查间隔的时间和等待的最大时间可以自定义。等待某个元素的Y坐标满足某个条件,等待时间采用系统默认的时间Function...
阅读全文