自动化测试培训课件(PPT).ppt

  1. 1、本文档共80页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
自动化测试培训课件(PPT)

元素实现的方法 给元素新增一个方法的流程 元素方法的具体实现 特殊Selectlist的处理 特殊Selectlist的处理二 对日期控件的处理 webdriver 如何处理时间控件: 1、使用比较普遍,也很通俗的方法 先切换到时间控件的frame,再在frame中实现所要点击时间的操作 2、使用js,实现把时间标签中的value属性赋值,这个值就是你想要选择的时间,注意时间格式;若改时间标签为只读,需要把只读限制去掉 以下为代码: JavascriptExecutor removeAttribute = (JavascriptExecutor)driver; //remove readonly attribute removeAttribute.executeScript(var setDate=document.getElementById(\train_date\);setDate.removeAttribute(readonly);) ; WebElement setDatElement=driver.findElement(By.xpath(//input[@id=train_date])); setDatElement.clear(); setDatElement.sendKeys(2015-02-18); 一些经验1 Frame处理: frame=ControllerChoose.getSpecificController().getSelectList(Finder.cssSelector,#iframe iframe); Object framedriver = frame.switchToFrame(); ReleasePoint=ControllerChoose.getSpecificController().getTextField(Finder.xpath, //table[@class=InputTB]/tbody/tr[1]/td[2]/span/input[1], framedriver); 日历格处理: 在page中定义Element 为Date类型 Plandate 在case中引用该Element的方法: BacicInfo.getInstance().plandate.DateValueUIC1_executeJScript(2014-10-10); 一些经验2 3.打开多个Tab,返回到初始的driver SetString handles = InitDriver.getWindowHandles(); 4.返回到指定url的driver InitDriver.SwitchToWindowByUrl(30/ropv2/ld_window/); 5.Alert处理 alert=ControllerChoose.getSpecificController().getAlertDialogue(); //page中定义 RollBackOperation.getInstance().alert.clickOK(); //case中调用方法 6.Select框处理 VersionSelect=ControllerChoose.getSpecificController().getSelectList(Finder.id, “ContentPlaceHolder1_rptAppList_ddlVersion_0”); //page中定义 RollBackOperation.getInstance().VersionSelect.selectValue(“v2”); //case中调用 一些经验3 WebDriver每次启动一个Firefox的实例时,会生成一个匿名的profile,并不会使用当前Firefox的profile。这点一定要注意。比如如果访问被测试的web服务需要通过代理,你想直接设置Firefox的代理是行不通的,因为WebDriver启动的Firefox实例并不会使用你这个profile,正确的做法是通过FirefoxProfile来设置。 public WebDriver create() { ? FirefoxProfile firefoxProfile = new FirefoxProfile(); firefoxProfile.setPreference(xy.type,1); firefoxProfile.setPreference(xy.http,yourProxy); firefoxProfile.setPreference(xy.http_port,yourPort); firefoxPr

您可能关注的文档

文档评论(0)

tangdequan1 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档