当前位置: 首页 > news >正文

筑成建设集团网站国外网站建设现状

筑成建设集团网站,国外网站建设现状,一条龙 有哪些服务,西安有什么网页设计公司一、环境配置 二、浏览器适配 //1.设置浏览器的位置,google浏览器位置是默认且固定在电脑里的//2.设置浏览器驱动的位置,C:\Users\27743\AppData\Local\Google\Chrome\ApplicationSystem.setProperty("webdriver.chrome.driver", "C:\\Users\\27743\\AppData\\…

一、环境配置

二、浏览器适配

//1.设置浏览器的位置,google浏览器位置是默认且固定在电脑里的//2.设置浏览器驱动的位置,C:\Users\27743\AppData\Local\Google\Chrome\ApplicationSystem.setProperty("webdriver.chrome.driver", "C:\\Users\\27743\\AppData\\Local\\Google\\Chrome\\Application\\chromedriver.exe");//3.加载浏览器
//		ChromeDriver chromeDriver = new ChromeDriver();WebDriver driver = new ChromeDriver();//4.通过chromeDriver打开浏览器
//		chromeDriver.get("https://www.baidu.com/");driver.get("https://www.baidu.com/");

这里配置selenium环境,推荐这篇文章全国大学生软件测试大赛Web应用测试(二)Selenium功能测试环境配置_慕测平台的eclipse插件-CSDN博客

通过这篇文章来学习 

02_浏览器适配_哔哩哔哩_bilibili 根据这个视频操作

设置自动补全功能 

三、浏览器基本操作

package selenium;import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriver.Navigation;
import org.openqa.selenium.WebDriver.Options;
import org.openqa.selenium.chrome.ChromeDriver;public class demo1 {public static void main(String[] args) {try {// TODO Auto-generated method stub//1.设置浏览器的位置,google浏览器位置是默认且固定在电脑里的//2.设置浏览器驱动的位置,C:\Users\27743\AppData\Local\Google\Chrome\ApplicationSystem.setProperty("webdriver.chrome.driver", "C:\\Users\\27743\\AppData\\Local\\Google\\Chrome\\Application\\chromedriver.exe");//3.加载浏览器
//			ChromeDriver chromeDriver = new ChromeDriver();WebDriver driver = new ChromeDriver();//4.通过chromeDriver打开浏览器
//			chromeDriver.get("https://www.baidu.com/");driver.get("https://www.baidu.com/");Thread.sleep(1500);//浏览器的操作//1.浏览器最大化driver.manage().window().maximize();
//			 Options manage = driver.manage();
//			 manage.window().maximize();Thread.sleep(1500);//2.获取导航类
//			Navigation nat = driver.navigate();
//			nat.to("https://www.baidu.com/s?wd=%E6%B8%85%E6%BE%88%E7%9A%84%E7%88%B1%E5%8F%AA%E4%B8%BA%E4%B8%AD%E5%9B%BD&sa=fyb_n_homepage&rsv_dl=fyb_n_homepage&from=super&cl=3&tn=baidutop10&fr=top1000&rsv_idx=2&hisfilter=1");driver.navigate().to("https://www.baidu.com/s?wd=%E6%B8%85%E6%BE%88%E7%9A%84%E7%88%B1%E5%8F%AA%E4%B8%BA%E4%B8%AD%E5%9B%BD&sa=fyb_n_homepage&rsv_dl=fyb_n_homepage&from=super&cl=3&tn=baidutop10&fr=top1000&rsv_idx=2&hisfilter=1");Thread.sleep(1500);//2.1浏览器后退
//			nat.back();driver.navigate().back();Thread.sleep(1500);//2.2浏览器前进
//			nat.forward();driver.navigate().forward();Thread.sleep(1500);//2.3浏览器的刷新driver.navigate().refresh();Thread.sleep(1500);//3.获取当前标题和urlString title = driver.getTitle();System.out.println("title:"+ title);System.out.println("url:"+driver.getCurrentUrl());//3.1重新打开浏览器,我们看当前的标题和url地址driver.get("https://www.baidu.com/");driver.navigate().to("https://yiyan.baidu.com/");System.out.println("title:"+ driver.getTitle());System.out.println("url:"+driver.getCurrentUrl());//last:关闭浏览器driver.quit();//last:关闭标签
//			driver.close();} catch (Exception e) {// TODO: handle exceptione.printStackTrace();}}}

四、元素的基本操作

package selenium;import java.util.List;import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;public class demo2 {public static void main(String[] args) {// TODO Auto-generated method stubtry {//1.设置浏览器驱动的位置System.setProperty("webdriver.chrome.driver", "C:\\Users\\27743\\AppData\\Local\\Google\\Chrome\\Application\\chromedriver.exe");//2.加载浏览器WebDriver driver = new ChromeDriver();//3.打开浏览器driver.get("file:///D:/RuanJian/selenium/code/demo1/index.html");//4.元素的基本操作,先定位后操作//定位WebElement input_name = driver.findElement(By.xpath("//*[@id=\"user2\"]"));System.out.println(input_name.getAttribute("value"));//测试账号//清空input_name.clear();//输入input_name.sendKeys("李聪聪");Thread.sleep(1000);//获取value属性的内容String value = input_name.getAttribute("value");//李聪聪System.out.println(value);//输入密码driver.findElement(By.xpath("//*[@id=\"password\"]")).sendKeys("123456");Thread.sleep(1000);//单选框选择女driver.findElement(By.xpath("/html/body/table/tbody/tr[4]/td[2]/input[2]")).click();Thread.sleep(1000);//复选框选择唱歌driver.findElement(By.xpath("/html/body/table/tbody/tr[5]/td[2]/input[3]")).click();Thread.sleep(1000);//下拉表单选择陕西,这个比较特殊,先获取这个元素,然后加载成select,最后进行操作WebElement select_table = driver.findElement(By.xpath("/html/body/table/tbody/tr[6]/td[2]/select"));Select select = new Select(select_table);//下拉表单,获取其中的值List<WebElement> options = select.getOptions();//法一for (WebElement webElement : options) {String text = webElement.getText();System.out.println(text);}//法二for (int i = 0; i < options.size(); i++) {WebElement webElement = options.get(i);String text = webElement.getText();System.out.println("index"+text);}//通过顺序选择 0开始select.selectByIndex(4);//陕西Thread.sleep(1000);//通过文字选择select.selectByVisibleText("北京");Thread.sleep(1000);//点击超链接driver.findElement(By.xpath("/html/body/table/tbody/tr[8]/td[2]/a")).click();//要确定到超链接那里Thread.sleep(1000);driver.navigate().back();Thread.sleep(1000);//多行文本输入driver.findElement(By.xpath("/html/body/table/tbody/tr[9]/td[2]/textarea")).sendKeys("666666");Thread.sleep(1000);//5.关闭浏览器driver.quit();} catch (Exception e) {// TODO: handle exceptione.printStackTrace();}}}

 

五、各种定位方式

六、xpath语法

七、二次定位和组识别

八、iframe操作

九、延迟调用

十、xpath案例

十一、上传文案

十二、截屏处理

十三、键盘模拟焦点切换

十四、悬停操作

十五、滚动加载

十六、日期设置

十七、切换标签

十八、自动登录

十九、模块适配

二十、数据参数读取

http://www.yayakq.cn/news/67928/

相关文章:

  • 烟台网站排名系统购物网站的功能板块
  • 收费网站解决方案手机网站有吗
  • 苏州做网站比较好的公司网站开发 常德
  • 做网站服务器空间长沙官网seo服务
  • 2018年网站开发技术免费杂志排版软件
  • 食品建设网站前的市场分析微博大v推广一次多少钱
  • 做网站需要买域名吗上海专业网站建设服
  • wordpress 本地服务器搭建xampp如何搭建 seo网站
  • 建设部网站上标准合同北京建设网坡屋顶改造工程指标
  • 台州路桥做网站的公司有哪些沈阳建设工程信息网平台电话
  • 西安网站建设专家深圳建设厅官方网站
  • 网站建设和网页建设的区别钢铁网站哪家做的好
  • 宁乡住房和城乡建设局网站科技之锤
  • 虹口免费网站制作个人网站做捐赠发布违法吗
  • 建设门户网站培训通知衡阳手机网站设计
  • 故事式软文广告300字东莞网络营销十年乐云seo
  • 网站注册搜索引擎的目的是快站优惠券app
  • 如何做校园网站芮城做网站的机构
  • 深圳建网站好的公司百度作文网站
  • 营销网站有哪些活动网站推广方案
  • 南宁网站搜索引有创意的食品包装设计
  • 企业网站排名优化利用数据库修改wordpress密码
  • 中山公司做网站网站左侧导航设计
  • 苏州建设招聘信息网站收录批量查询工具
  • 网站开发版本号dw网页制作软件官网
  • 网站页面设计多少钱网站制作收费标准
  • 市桥做网站的公司在哪个网站做视频赚钱
  • ui网站界面设计模板软件app下载大全
  • 肯达建设网站怎样优化网站关键词
  • 阜阳网站开发招聘asp.net mvc网站发布教程