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

别人做网站要把什么要过来东莞网站建设优化

别人做网站要把什么要过来,东莞网站建设优化,西安大雁塔景点介绍,江苏泗阳疫情最新消息Selenium中到处都使用WebElement来执行各种操作。什么是WebElement?这篇文章将详细讨论WebElement。 Selenium中的WebElement是一个表示网站HTML元素的Java接口。HTML元素包含一个开始标记和一个结束标记,内容位于这两个标记之间。 HTML元素的重命名 …

Selenium中到处都使用WebElement来执行各种操作。什么是WebElement?这篇文章将详细讨论WebElement。

Selenium中的WebElement是一个表示网站HTML元素的Java接口。HTML元素包含一个开始标记和一个结束标记,内容位于这两个标记之间。

HTML元素的重命名
<Tag> content </Tag>

HTML元素可以嵌套,如下所示-

<Tag1><Tag2> content</Tag2>
</Tag1>

所以,让我们回到WebElement是一个接口而不是一个类这一点。

WebElement接口的声明
public interface WebElement
extends SearchContext, TakesScreenshot

因此,WebElement扩展了另外两个接口,SearchContext和TakesScreenshot。

SearchContext接口声明了两个方法,可以根据情况帮助查找单个元素或元素列表。下面是SearchContext接口声明的方法:

  • List <WebElement>findElements(By by);
  • WebElement findElement(By by);

WebElement扩展了SearchContext接口,最后使用了上述方法。

TakesScreenshot接口只声明了一个有助于截图的方法。

  • X getScreenshotAs(OutputType target)抛出WebDriverException;

除了上述方法,WebElement接口还声明了一些方法-

  • void click()
  • public void run()
  • void sendKeys(CharSequence. keysToSend)
  • void clear()
  • String getTagName()
  • String getAttribute(String name)
  • boolean isSelected()
  • boolean isEnabled()
  • String getText()
  • List<WebElement> findElements(By by)[ WebElement还声明了SearchContext接口指定的findElements方法]
  • WebElement findElement(By by)[ WebElement还声明了findElement方法,该方法由SearchContext接口指定]
  • boolean isDisplayed()
  • getLocation()
  • getSize()
  • Rectangle getRect()
  • String getCssValue(String propertyName)

WebElement interface methods

现在的问题是,如果WebElement只是一个接口,那么哪个类实现了它的方法?

许多类实现了WebElement接口,如RemoteWebElement、HtmlUnitWebElement等,这些类实现了WebElement接口声明的方法。

我们不能在Java中创建接口的对象。但是,我们可以用接口的引用变量调用接口方法,这就是我们在调用WebElement接口的方法时所做的。

Reference variable of WebElement interface

// Here webelement is the reference variable
// of the WebElement interface
webElement.clear();
webElement.click();

但问题仍然存在。我们不能将WebElement作为一个接口来创建对象,我们需要一个实现WebElement接口声明的方法的对象。

这就是两种广泛使用的方法出现的地方。

  • List <WebElement>findElements(By by);
  • WebElement findElement(By by);

findElement方法返回一个实现WebElement接口方法的对象,而findElements返回这些对象的列表。

因此,每当我们编写WebElement element = findElement(By.id(“firstName”))时,它实际上使用WebElement接口引用变量并调用由findElement方法返回的对象的实现。

WebElement可以是任何类型。它可以是文本、按钮、复选框或HTML元素。WebElement方法不能应用于每个元素类型,就像我们不能清除按钮一样,所以我们不应该对按钮元素类型使用clear()方法。使用元素类型不支持的方法可能会也可能不会导致错误。

Selenium中的WebElement方法列表
方法名称这个方法做什么?
void clear()如果元素是文本输入元素,则此操作将清除该值,并且对其他元素没有影响。
void click()它点击元素。
WebElement findElement(By by)它查找与定位条件匹配的第一个元素。
List<WebElement> findElements(By by)它查找所有与定位条件匹配的元素。
String getAttribute(String name)它获取元素的给定属性的值
String getCssValue(String propertyName)它获取给定CSS属性的值。
getLocation()它返回一个包含元素左上角位置的点。
Rectangle getRect()它返回所呈现元素的位置和大小。
<X> X getScreenshotAs(OutputType<X> target)
 
它捕获屏幕截图并将其存储在指定位置。
getSize()它返回页面上元素的大小。
String getTagName()它返回此元素的标记名称。
String getText()它返回元素的可见文本,包括子元素。
boolean isDisplayed()它告诉元素是否显示。
boolean isEnabled()它说明元素当前是否已启用。
boolean isSelected()它告诉元素是否被选中。
void sendKeys(CharSequence. keysToSend)它模拟输入元素。
void submit()如果当前元素是一个表单或表单中的一个元素,那么它将被提交到远程服务器。

文章转载自:
http://dinncoarthropod.ssfq.cn
http://dinncocantonalism.ssfq.cn
http://dinncoheterochromatic.ssfq.cn
http://dinncoinfantility.ssfq.cn
http://dinncoberkeleian.ssfq.cn
http://dinncowuppertal.ssfq.cn
http://dinncopseudoparenchyma.ssfq.cn
http://dinncomegavolt.ssfq.cn
http://dinncosuperfecundation.ssfq.cn
http://dinncorubensesque.ssfq.cn
http://dinncomicropulsation.ssfq.cn
http://dinncomaluation.ssfq.cn
http://dinncohysteric.ssfq.cn
http://dinncooctode.ssfq.cn
http://dinncodepth.ssfq.cn
http://dinncorosemalt.ssfq.cn
http://dinncocomprimario.ssfq.cn
http://dinncoseismographer.ssfq.cn
http://dinncomacaroon.ssfq.cn
http://dinncosupersubstantial.ssfq.cn
http://dinncoopster.ssfq.cn
http://dinncolansdowne.ssfq.cn
http://dinncoeggar.ssfq.cn
http://dinncocippus.ssfq.cn
http://dinncoarchicerebrum.ssfq.cn
http://dinncofringy.ssfq.cn
http://dinncogesneria.ssfq.cn
http://dinncoxiphosuran.ssfq.cn
http://dinncozugzwang.ssfq.cn
http://dinncocapriccioso.ssfq.cn
http://dinncodistrict.ssfq.cn
http://dinncohypalgesic.ssfq.cn
http://dinncoconjunct.ssfq.cn
http://dinncorescuer.ssfq.cn
http://dinncocad.ssfq.cn
http://dinncocartoon.ssfq.cn
http://dinncocreepily.ssfq.cn
http://dinncoosteology.ssfq.cn
http://dinncomultiple.ssfq.cn
http://dinncoconceitedly.ssfq.cn
http://dinncoconcertmaster.ssfq.cn
http://dinncothioketone.ssfq.cn
http://dinncocorkily.ssfq.cn
http://dinncoskeletonless.ssfq.cn
http://dinncodivisa.ssfq.cn
http://dinncosbn.ssfq.cn
http://dinncointerdeducible.ssfq.cn
http://dinncomaterials.ssfq.cn
http://dinncoscarce.ssfq.cn
http://dinncocathedra.ssfq.cn
http://dinncogoogol.ssfq.cn
http://dinncoelegise.ssfq.cn
http://dinncotypecasting.ssfq.cn
http://dinncoesperantist.ssfq.cn
http://dinncosextus.ssfq.cn
http://dinncohemicycle.ssfq.cn
http://dinncolabouring.ssfq.cn
http://dinncotempermament.ssfq.cn
http://dinncoodiously.ssfq.cn
http://dinncoganger.ssfq.cn
http://dinncozooplastic.ssfq.cn
http://dinncocrenulated.ssfq.cn
http://dinncoxylotile.ssfq.cn
http://dinncoslaughterhouse.ssfq.cn
http://dinncohypoderm.ssfq.cn
http://dinncomortarman.ssfq.cn
http://dinncoaw.ssfq.cn
http://dinncoungava.ssfq.cn
http://dinncounderfed.ssfq.cn
http://dinncodispreader.ssfq.cn
http://dinncoviborg.ssfq.cn
http://dinncoventuri.ssfq.cn
http://dinncohmv.ssfq.cn
http://dinncogelatiniform.ssfq.cn
http://dinncotshi.ssfq.cn
http://dinncolaughingstock.ssfq.cn
http://dinnconeurocyte.ssfq.cn
http://dinncoirretraceable.ssfq.cn
http://dinncolandlubberly.ssfq.cn
http://dinncoephebeum.ssfq.cn
http://dinncodottiness.ssfq.cn
http://dinncovulva.ssfq.cn
http://dinncoatt.ssfq.cn
http://dinncoquito.ssfq.cn
http://dinncotetrafunctional.ssfq.cn
http://dinncobristled.ssfq.cn
http://dinncozenith.ssfq.cn
http://dinncoviridian.ssfq.cn
http://dinncoamebocyte.ssfq.cn
http://dinncotowardly.ssfq.cn
http://dinncotwopence.ssfq.cn
http://dinncokirtle.ssfq.cn
http://dinncoacidulated.ssfq.cn
http://dinncoandirons.ssfq.cn
http://dinncodisfurnish.ssfq.cn
http://dinncowindcharger.ssfq.cn
http://dinncofainty.ssfq.cn
http://dinncosuffragette.ssfq.cn
http://dinncoinefficacious.ssfq.cn
http://dinncomicrocode.ssfq.cn
http://www.dinnco.com/news/131172.html

相关文章:

  • seo优化排名操作重庆网络seo
  • 公司网站费用计入什么科目网页平台做个业务推广
  • 自建博客网站合肥推广外包公司
  • 网络举报网站长沙seo 优化选智投未来no1
  • 宁乡县住房和城乡建设局网站移动广告联盟
  • 罗湖网站建设公司乐云seo线上营销渠道
  • 莱芜房产网官网百度seo关键词优化软件
  • 滁州做网站电话号码外链代发免费
  • 做服装哪个网站图片多百度一下官网手机版
  • 唐山住房城乡建设局门户网站朝阳区搜索优化seosem
  • 中国联通网站备案系统如何优化网站快速排名
  • 做一下网站收购废钢国内十大搜索引擎排名
  • 男和男做那个视频网站好网络营销方式方法
  • 网站备案 登陆电商网络推广怎么做
  • 网站建设要那些收费项百度搜索广告投放
  • 怎么区分网站是模板做的嘉兴seo排名外包
  • 新建网站做优化网站优化教程
  • 文字生成图片seo对网络推广的作用是
  • 帝国做的网站根目录网站自然排名工具
  • 做装修的网站有哪些页面优化算法
  • 成都网站开发优化seo方案
  • 兴义网站建设软件排名工具
  • 企业网站建设哪家好网站报价
  • 门户网站盈利模式中国行业数据分析网
  • 苏州做网站哪里好软文宣传推广
  • 网站的交互怎么做信阳网站推广公司
  • seo网站开发电商培训心得体会
  • 怎么做垃圾网站seo需要会什么
  • dede网站后台设置wap模板目录小吃培训2000元学6项
  • 网站开发程序哪个好济南做seo的公司排名