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. Linux系统的信号详解

    一.信号类型 1) SIGHUP       2) SIGINT       3) SIGQUIT     4) SIGILL        5) SIGTRAP 6) SIGABRT      7) ...

  2. windows指令

    &        无条件执行&符号后面的命令: &&      当&&前面的命令成功执行时,执行&&后面的命令,否则不执行: ||   ...

  3. 有indexPath获取到cell对象

    //SHSecretaryTipsCell *cell=(SHSecretaryTipsCell *)[tableView cellForRowAtIndexPath:indexPath];

  4. git 更新分支

    git branch  本地分支 git branch test 创建分支 git pull origin fastboot 更新到最新版本 git branch -a  查看所有的分支,包括本地的和 ...

  5. Servlet学习三:不允许直接访问jsp处理方式一过滤器

    转自:http://zy19982004.iteye.com/blog/1755189

  6. wpf之数据触发器DataTrigger

    wpf, 根据绑定的属性的值的不同(数据分类),界面上显示不同的控件(绑定不同类型的属性),可以使用数据库触发器DataTrigger实现这一功能. 实现的效果如下: 首先建立实体类: 更改通知类: ...

  7. Hibernate 系列教程5-双向多对一

    主要讲解inverse和cascade的用法 cascade定义的是关系两端对象到对象的级联关系: 而inverse定义的是关系和对象的级联关系(管理外键的值). inverse 属性默认是false ...

  8. curl file_get_contents fsockopen

    三种处理的方式:     curl     file_get_contents     fsockopen fsockopen 是比较底层的调用,属于网络系统的socket调用,而curl经过的包装支 ...

  9. python解析XML之ElementTree

    #coding=utf-8 from xml.etree import ElementTree as ET tree=ET.parse('test.xml') root = tree.getroot( ...

  10. CC_CALLBACK之间的区别

    #define CC_CALLBACK_0(__selector__,__target__, ...) std::bind(&__selector__,__target__, ##__VA_A ...