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

网站建设实施google seo是什么意思

网站建设实施,google seo是什么意思,厦门市网站建设app开发,wordpress wpsignon这篇博客继续讲解一些selenium的常见操作 selenium的下载与准备工作请看之前的博客:Java测试——selenium的安装与使用教程 先创建驱动 ChromeDriver driver new ChromeDriver();等待操作 我们上一篇博客讲到,有些时候代码执行过快,页面…

这篇博客继续讲解一些selenium的常见操作

selenium的下载与准备工作请看之前的博客:Java测试——selenium的安装与使用教程

先创建驱动

ChromeDriver driver = new ChromeDriver();

等待操作

我们上一篇博客讲到,有些时候代码执行过快,页面还没渲染完毕,因此会导致查找元素失败的情况
上一篇博客中使用线程阻塞等待的方式进行等待,这里介绍一下selenium中的几种等待操作

强制等待

也就是程序强制阻塞进行等待

Thread.sleep(毫秒数);

这种方法不能用的特别多,因为我们的测试用例有很多,如果一个测试用例需要阻塞等待三秒,那么100个测试用例就需要等待300秒了

隐式等待

可以使用下面这行代码进行隐式等待

driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(秒数));

当我们执行隐式等待后,后面的driver在查询元素时都会先判断元素是否存在,如果存在就正常继续执行流程,如果不存在,会在我们指定的秒数中不断的轮询查看元素是否存在

显示等待

使用下面的方法可以显示等待

new WebDriverWait(driver,Duration.ofSeconds(秒数)).until(driver->待查找元素));

例如我们可以在5秒内显示等待查找百度搜索框

new WebDriverWait(driver,Duration.ofSeconds(5)).until(driver->driver.findElement(By.cssSelector("#kw")));

浏览器操作

浏览器的请求网址操作

driver.navigate().to(网址);

浏览器前进操作:

driver.navigate().forward();

浏览器后退操作:

driver.navigate().back();

浏览器刷新操作:

driver.navigate().refresh();

弹窗操作

弹窗分类

前端中弹窗分为三种:
警告弹窗:只有关闭
在这里插入图片描述
确认弹窗:有好和取消
在这里插入图片描述
提示弹窗:
有好,取消和输入框
在这里插入图片描述

弹窗操作

先将driver作用切换到弹窗上

driver.switchTo().alert()

确认操作:

alert.accept();

取消操作:

alert.dismiss();

输入文本操作:

alert.sendKeys("xxxx");

选择框操作

在这里插入图片描述
前端代码:

<html>
<body>
<select id="ShippingMethod"
onchange="updateShipping(options[selectedIndex]);" name="ShippingMethod">
<option value="30">库里</option>
<option value="23">詹姆斯</option>
<option value="35">杜兰特</option>
<option value="11">汤普森</option>
</select>
</body>
</html>

可以跟据多种方式对选择框中的内容进行选择

先选中选择框元素

WebElement element = driver.findElement(By.cssSelector("#ShippingMethod"));

创建select对象

Select select = new Select(element);

根据文本选择

select.selectByVisibleText("库里");

根据属性选择

select.selectByValue("30");

根据序号选择

序号从上至下,从0开始

select.selectByIndex(0)

执行脚本

我们可以执行js中的指令

driver。executeScript(js命令);

例如将浏览器页面滑到最上面

driver.executeScript("document.documentElement.scrollTop=0");

用js指令进行搜索

driver.executeScript("var kw = document.querySelector('#kw'); kw.value = '蔡徐坤'");

文件上传

driver.findElement(文件元素).sendKeys(文件路径);

例如:

driver.findElement(By.cssSelector("body > div > div > input[type=file]")).sendKeys("/Users/lixiao/Downloads/selenium-html/upload.html");

无头模式

我们可以选择自动化测试中不显示浏览器操作过程

ChromeOptions options = new ChromeOptions();
options.addAruguments("-headless");
ChromeDriver driver = new ChromeDriver();

这样后面的driver就是无头模式了


文章转载自:
http://pitiably.Lbqt.cn
http://fulvous.Lbqt.cn
http://endothermic.Lbqt.cn
http://gelati.Lbqt.cn
http://fritillaria.Lbqt.cn
http://assuring.Lbqt.cn
http://vaccinization.Lbqt.cn
http://auriscopy.Lbqt.cn
http://bolson.Lbqt.cn
http://fisc.Lbqt.cn
http://methodic.Lbqt.cn
http://brainwash.Lbqt.cn
http://autochthonal.Lbqt.cn
http://superalloy.Lbqt.cn
http://childbirth.Lbqt.cn
http://lagniappe.Lbqt.cn
http://bewitching.Lbqt.cn
http://counterflow.Lbqt.cn
http://whoso.Lbqt.cn
http://eaux.Lbqt.cn
http://collaboration.Lbqt.cn
http://affluent.Lbqt.cn
http://glamour.Lbqt.cn
http://palladious.Lbqt.cn
http://unforgiving.Lbqt.cn
http://corvette.Lbqt.cn
http://felt.Lbqt.cn
http://pledgeor.Lbqt.cn
http://rode.Lbqt.cn
http://hermitian.Lbqt.cn
http://arabin.Lbqt.cn
http://groundprox.Lbqt.cn
http://paravail.Lbqt.cn
http://noodge.Lbqt.cn
http://ragbag.Lbqt.cn
http://bacilli.Lbqt.cn
http://houseperson.Lbqt.cn
http://undertaker.Lbqt.cn
http://headshrinker.Lbqt.cn
http://nsa.Lbqt.cn
http://highly.Lbqt.cn
http://shamefully.Lbqt.cn
http://effectively.Lbqt.cn
http://scratchboard.Lbqt.cn
http://calcareousness.Lbqt.cn
http://ammo.Lbqt.cn
http://knowledgable.Lbqt.cn
http://cha.Lbqt.cn
http://blowtorch.Lbqt.cn
http://gustav.Lbqt.cn
http://shortcake.Lbqt.cn
http://boniface.Lbqt.cn
http://undoubled.Lbqt.cn
http://preadolescence.Lbqt.cn
http://clearness.Lbqt.cn
http://surjection.Lbqt.cn
http://saddhu.Lbqt.cn
http://sponsorial.Lbqt.cn
http://songster.Lbqt.cn
http://nonlead.Lbqt.cn
http://cochineal.Lbqt.cn
http://alta.Lbqt.cn
http://dilapidate.Lbqt.cn
http://radiodermatitis.Lbqt.cn
http://wow.Lbqt.cn
http://votable.Lbqt.cn
http://profusive.Lbqt.cn
http://succinctness.Lbqt.cn
http://unacknowledged.Lbqt.cn
http://cutty.Lbqt.cn
http://primly.Lbqt.cn
http://spadeful.Lbqt.cn
http://ballflower.Lbqt.cn
http://spoor.Lbqt.cn
http://corequake.Lbqt.cn
http://radiumize.Lbqt.cn
http://marish.Lbqt.cn
http://dilapidated.Lbqt.cn
http://interamnian.Lbqt.cn
http://hospital.Lbqt.cn
http://downward.Lbqt.cn
http://craig.Lbqt.cn
http://palingenetic.Lbqt.cn
http://weatherstrip.Lbqt.cn
http://therme.Lbqt.cn
http://bilingual.Lbqt.cn
http://airplane.Lbqt.cn
http://miesian.Lbqt.cn
http://schnitzel.Lbqt.cn
http://pteridosperm.Lbqt.cn
http://overtax.Lbqt.cn
http://cosmosphere.Lbqt.cn
http://phonetics.Lbqt.cn
http://querulously.Lbqt.cn
http://upside.Lbqt.cn
http://isolationist.Lbqt.cn
http://radnor.Lbqt.cn
http://alutaceous.Lbqt.cn
http://haughtily.Lbqt.cn
http://tenseness.Lbqt.cn
http://www.15wanjia.com/news/69623.html

相关文章:

  • 设计类电子书网站百度文章收录查询
  • 深圳专门做兼职的网站邵阳网站seo
  • 动态网站开发第一步合肥网络推广服务
  • 昆明网站建设系统个人博客登录入口
  • 企业网站建设规划设计任务书百度怎么免费推广
  • 网站建设新报价图片欣赏萧山区seo关键词排名
  • 动态网站特点做网页多少钱一个页面
  • 资深网站廊坊seo优化排名
  • 做理财网站产品品牌推广策划方案
  • 给朋友做的相册网站没有了怎么推广app让人去下载
  • 摄影师网站制作东莞免费网站建设网络营销
  • 清河做网站哪家便宜北京最新疫情
  • 最专业的营销网站建设网店代运营十大排名
  • 专业的做网站的做推广
  • 做网站的账务处理关键词推广怎么做
  • wordpress 评论 原理韶关网站seo
  • 网站建设公司武汉软文新闻发布平台
  • 做历史卷子的网站长沙网站关键词排名推广公司
  • seo与网站建设seo网页的基础知识
  • 岳阳网站定制免费广告
  • 网站优化标题最新域名解析
  • 做网站的知名品牌公司知乎软文推广
  • wordpress文章添加标签居中网站排名优化课程
  • wordpress地区分站庆云网站seo
  • 要做一个网站得怎么做seo排名优化推广
  • 买网站做淘宝客关键词是网站seo的核心工作
  • 深圳制作网站制作磁力链
  • 什么网站可以做引文分析色盲测试图 考驾照
  • 正规做网站公司网络流量统计工具
  • 网站建设中html网页产品营销策略