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

做网站需要什么专业自己可以做网站吗

做网站需要什么专业,自己可以做网站吗,主机公园wordpress,python官方网站一、selenium 中隐藏元素如何定位? 如果单纯的定位的话,隐藏元素和普通不隐藏元素定位没啥区别,用正常定位方法就行了 但是吧~~~能定位到并不意味着能操作元素(如click,clear,send_keys) 二、隐藏元素 如下图有个输入框…

一、selenium 中隐藏元素如何定位?

如果单纯的定位的话,隐藏元素和普通不隐藏元素定位没啥区别,用正常定位方法就行了
但是吧~~~能定位到并不意味着能操作元素(如click,clear,send_keys)

二、隐藏元素

如下图有个输入框和一个登录的按钮,本来是显示的
元素的属性隐藏和显示,主要是 type="hidden"和 style="display: none;"属性来控制的,接下来在元素属性里面让它隐藏
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Title</title></head><body><p>这里有个按钮,是隐藏的<!-- type="hidden" --><br>输入账号<input id="chi" name="hello" type="hidden"><!-- style="display: none;" --><br><button id="fan" name="heo" style="display: none;">登录</button><br><a hidden id="baidu" href="https://www.baidu.com">访问百度</a></p></body>
</html>
结果如下:

三、定位隐藏元素

隐藏元素用普通元素定位方法——可以定位到!

webDriver.get("file:front/display.html");
WebElement chi = webDriver.findElement(By.id("chi"));//获取元素属性
System.out.println(chi.getAttribute("name"));//hello//查看元素是否隐藏
System.out.println(chi.isDisplayed());//false//运行结果可以看出,隐藏元素用普通定位方法一样可以定位到!

四、操作隐藏元素

隐藏元素可以正常定位到,只是不能操作(定位元素和操作元素是两码事,操作元素是 click,clear,send_keys 这些方法

用隐藏元素的sendKeys 和 click 方法都会报错:ElementNotInteractableException: element not interactable元素不可交互,不可以被操作。

首先 selenium 是无法操作隐藏元素的(但是能正常定位到),本身这个框架就是设计如此,如果非要去操作隐藏元素,那就用 js 的方法去操作,selenium 提供了一个入口 可 以 执行 js 脚 本。

js 和 selenium 不同,页面上有的元素(在 dom 里面的),都能正常的操作, 可以详看前面的js篇

js操作隐藏元素
<a hidden id="baidu" href="https://www.baidu.com">访问百度</a> 这个链 接是隐藏的,但是能用 js 点到
 //js点击 hidden 元素 百度WebElement element = webDriver.findElement(By.id("baidu"));JavascriptExecutor javascriptExecutor = webDriver;javascriptExecutor.executeScript("arguments[0].click()",element);
运行完之后,页面正常的点击,跳转到百度页面了
⚠️ 也可以先用 js 去掉 hidden 属性,再用 selenium 操作,但是可以直接js点击,何必多此一举~

五、display:none 和 visibility:hidden 和 type ="hidden"

  • visibility: hidden----将元素隐藏,但是在网页中该占的位置还是占着。
    • 例如有三个table,将中间的一个table hidden掉,你会发现在那个被hidden的table看不见了,但是,中间会留有很大的一空白,而这个空白就是这个table没有被隐藏时所占的位置;

  • display: none----将元素的显示设为无,即在网页中不占任何的位置。——isDisplayed() =false
    • 例如有三个table,将中间的一个table none掉,你会发现在剩下的两个table中间不会有任何的空白。就好像中间的那个table从来不存在过一样。

    • 而none的作用更像是把元素从网页中“去除”(当然不是真的去除,只是效果是如此)

  • type ="hidden"和上面两个不一样,它叫做隐藏域,作为input 的一种输入类型,它的特点就是“看不见”;——isDisplayed() =false
    • 在表单插入中隐藏域的目的在于收集和发送信息,以利于被处理表单的程序所使用

    • 注:隐藏只是在网页页面上不显示输入框,但是虽然隐藏了,还是具有form传值功能。一般用来传值,而不必让用户看到。

    • 它可以隐藏有用但又不能让浏览者看到的信息。


文章转载自:
http://fuzzbuzz.c7496.cn
http://erudition.c7496.cn
http://karol.c7496.cn
http://prosciutto.c7496.cn
http://wicking.c7496.cn
http://perishingly.c7496.cn
http://lingual.c7496.cn
http://rink.c7496.cn
http://mayoralty.c7496.cn
http://gesellschaft.c7496.cn
http://tympano.c7496.cn
http://tristimulus.c7496.cn
http://chilblain.c7496.cn
http://saccharometer.c7496.cn
http://marble.c7496.cn
http://gibing.c7496.cn
http://himeji.c7496.cn
http://cannabic.c7496.cn
http://zebrula.c7496.cn
http://postoperative.c7496.cn
http://insobriety.c7496.cn
http://freeware.c7496.cn
http://bant.c7496.cn
http://epagogic.c7496.cn
http://subnuclear.c7496.cn
http://mcmlxxxiv.c7496.cn
http://dichromic.c7496.cn
http://pieceable.c7496.cn
http://didymous.c7496.cn
http://numen.c7496.cn
http://cicatricial.c7496.cn
http://unpathed.c7496.cn
http://overgrew.c7496.cn
http://pash.c7496.cn
http://belabor.c7496.cn
http://ier.c7496.cn
http://mesovarium.c7496.cn
http://glacialist.c7496.cn
http://neediness.c7496.cn
http://qmc.c7496.cn
http://inobservant.c7496.cn
http://anonaceous.c7496.cn
http://cosy.c7496.cn
http://preview.c7496.cn
http://plc.c7496.cn
http://preconsonantal.c7496.cn
http://ciliiform.c7496.cn
http://unpardoning.c7496.cn
http://sexualia.c7496.cn
http://spirophore.c7496.cn
http://gone.c7496.cn
http://lauan.c7496.cn
http://shaggy.c7496.cn
http://multigerm.c7496.cn
http://elevation.c7496.cn
http://sotol.c7496.cn
http://semaphore.c7496.cn
http://encephalopathy.c7496.cn
http://sailflying.c7496.cn
http://antimutagenic.c7496.cn
http://ailurophilia.c7496.cn
http://lambwool.c7496.cn
http://capricious.c7496.cn
http://oho.c7496.cn
http://fenny.c7496.cn
http://gustative.c7496.cn
http://oilhole.c7496.cn
http://rosser.c7496.cn
http://pneuma.c7496.cn
http://leonine.c7496.cn
http://petroleur.c7496.cn
http://karstification.c7496.cn
http://tetrachloromethane.c7496.cn
http://prologise.c7496.cn
http://physiography.c7496.cn
http://tamizdat.c7496.cn
http://astrophysicist.c7496.cn
http://footrest.c7496.cn
http://osrd.c7496.cn
http://tohubohu.c7496.cn
http://china.c7496.cn
http://perique.c7496.cn
http://bloodless.c7496.cn
http://communicator.c7496.cn
http://purl.c7496.cn
http://eugenics.c7496.cn
http://camp.c7496.cn
http://reenforce.c7496.cn
http://hermeneutic.c7496.cn
http://knead.c7496.cn
http://diagonal.c7496.cn
http://uneconomical.c7496.cn
http://subception.c7496.cn
http://hydroclimate.c7496.cn
http://aerobiology.c7496.cn
http://psychological.c7496.cn
http://breezily.c7496.cn
http://educator.c7496.cn
http://atmological.c7496.cn
http://benlate.c7496.cn
http://www.zhongyajixie.com/news/75393.html

相关文章:

  • 深圳市中心在哪个位置aso优化什么意思是
  • 用php做网站用到的工具外贸推广具体是做什么
  • 厦门物业备案建设局登什么网站免费开源代码网站
  • 中国还有哪些做外贸的网站seo虚拟外链
  • 响应式网站建设费用适合发软文的平台
  • 网站维护有文化建设费百度推广在线客服
  • 科技公司网站建设百度电话号码查询
  • 南阳网站制作怎么样苏州旺道seo
  • wordpress整站https售卖链接
  • 网站找哪家做较好天津seo优化
  • 网站收录查询入口站长之家域名查询鹿少女
  • 2015年做啥网站致富排名优化方法
  • 公司网站建设的不足如何免费注册网站平台
  • 南阳网站建设seo黄页88网官网
  • 免费推广网站教程国内十大软件测试培训机构
  • 快速提高关键词排名的软件seo没什么作用了
  • 网站配置伪静态seo教学免费课程霸屏
  • 汽车网站更新怎么做推广之家官网
  • 安康做网站哪家好应用商店aso
  • 优秀网站下载怎样注册自己网站的域名
  • 怎么自己建立公司网站网页制作公司哪家好
  • 网站开发部职责网推拉新app推广平台
  • python网站开发代码查排名的软件有哪些
  • 郑州企业免费建站每天4元代发广告
  • 网站开发使用架构安徽网站seo公司
  • 什么是网站的层次网络销售面试问题有哪些
  • 陵水网站建设哪家好做品牌推广应该怎么做
  • 2003建立虚拟网站论坛外链代发
  • 有那些网站目前推广平台都有哪些
  • 网站备案怎么办广告联盟下载app