http://stackoverflow.com/questions/32234205/how-to-get-html-code-of-a-webelement-in-selenium

WebElement wantele=findwebele.findElement(By.cssSelector("div.row.row-2.title"));

webElement.getAttribute("href");
webElement.getAttribute("class");
String s = we.getAttribute("outerHTML");
webElement.getAttribute("innerHTML");

WebElement wantele=findwebele.findElement(By.cssSelector("div.row.row-2.title"));
System.out.println("点击");
wantele=findwebele.findElement(By.cssSelector("a"));
//wantele.getAttribute("a[href]")
//wantele.click();
//Thread.sleep(5000);
System.out.println("url:"+wantele.getAttribute("href"));
//wantele.

 

How to get HTML code of a WebElement in Selenium的更多相关文章

  1. 元素(WebElement)-----Selenium快速入门(三)

    上一篇<元素定位-----Selenium快速入门(二)>说了,如何定位元素,本篇说说找到的元素(WebElement)该怎么用. WebElement常用方法:  返回值  方法名  说 ...

  2. AttributeError: 'WebElement' object has no attribute 'send_keys'

    这个是没问题的代码:用来打开谷歌搜索cheese并退出 from selenium import webdriver from selenium.common.exceptions import Ti ...

  3. Selenium Page object Pattern usage

    使用Selenium的framework,大家免不了要使用他的page object pattern来开发适合自己的framework,原因很简单,page object 可以将测试的对象抽象成一个个 ...

  4. 判断Selenium加载完成

    How do you make Selenium 2.0 wait for the page to load? You can also check pageloaded using followin ...

  5. selenium docs

    Note to the Reader - Docs Being Revised for Selenium 2.0! Introduction Test Automation for Web Appli ...

  6. selenium webdriver自动化测试

    selenium家族介绍           Selenium IDE:Selenium IDE是嵌入到Firefox浏览器中的一个插件,实现简单的浏览器操作的录制与回放功能.   Selenium ...

  7. Web自动化测试工具调研

    背景 Web自动化测试越来越被重视, 因为现在Web已经是工程化的状态. 如何通过工具测试, 保证Web开发的质量,提升开发效率,是Web工具的诞生的来由. Web测试分为以下几个方面: 1. 界面测 ...

  8. Selenium+Java显示等待和隐式等待

    描述:用来操作界面上的等待时间,显示等待是等待某一条件满足,条件满足后进行后面的操作:隐式等待是给出一个等待时间,在时间到达之前若满足条件,则立即执行后续操作. public class TestSe ...

  9. python自动化,使用unittest对界面操作,读取excel表格数据输入到页面查询结果,在把结果保存到另外一张excel中

    # -*- coding: utf-8 -*-from selenium import webdriverfrom selenium.webdriver.common.by import Byfrom ...

随机推荐

  1. 安卓OpenGL入门

    1.先用一个GLSurfaceView作为画布,然后自定义一个Renderer继承自Renderer,把这个自定义的Renderer通过setRenderer()设置给GLSurfaceView就可以 ...

  2. asp.net textbox控件readonly为true时,后台取值的问题

    如题,在后台通过textbox.Text方式取值为空,不论你默认值是否是空,如想要获得,需通过request.Form[""]的方式.

  3. linux c中select使用技巧

    1.select函数作为定时器使用    it_value.tv_sec = 0;    it_value.tv_usec = 100000:    select(1,NULL,NULL,NULL,& ...

  4. Stu Website

    GIT: 分支的新建与合并 https://git-scm.com/book/zh/v2/Git-分支-分支的新建与合并 分支的管理 https://git-scm.com/book/zh/v1/Gi ...

  5. mongodb移除分片

    MongoDB的Shard集群来说,添加一个分片很简单,AddShard就可以了. 但是缩减集群(删除分片)这种一般很少用到.由于曙光的某服务器又挂了,所以我们送修之前必须把它上面的数据自动迁移到其他 ...

  6. Cookie 的设置和获取

    获取:var userName = getCookieValue("userName"); 设置:setCookie("userName",equpid,24, ...

  7. sqlserver2008行锁

    select * from tablename WITH (UPDLOCK) where Id=#value#

  8. PHP的PDO操作实例

    try{             $dbms='mysql';          //数据库类型 ,对于开发者来说,使用不同的数据库,只要改这个,不用记住那么多的函数       $host='127 ...

  9. iOS拨打电话(三种方法)

    iOS拨打电话(三种方法)  查了很多地方的关于iOS程序拨打电话,大都不全,今天我总结了三种方法,各有不同,拿来给大家分享,希望给大家有所帮助 1,这种方法,拨打完电话回不到原来的应用,会停留在通讯 ...

  10. RMQ 详解

    RMQ(Range Minimum/Maximum Query)问题:RMQ问题是给定一个区间,求这个区间中的最大或最小值的问题 RMQ采用动态规划的思想来求解:(st算法:Square Table) ...