css selector: xpath:

css selector:

$$(".mainLeft>div>h1")

xpath:

$x(".mainLeft>div>h1")

name = selectText(".mainLeft>div>h1");
xingzhi = selectText(".comTinyDes>tbody>tr:nth-child(1)>td:nth-child(2)>span");
guimo = selectText(".comTinyDes>tbody>tr:nth-child(2)>td:nth-child(2)>span");
wangzhan = selectText(".comTinyDes>tbody>tr:nth-child(3)>td:nth-child(2)>span");
hangye = selectText(".comTinyDes>tbody>tr:nth-child(4)>td:nth-child(2)>span");
dizhi = selectText(".comTinyDes>tbody>tr:nth-child(5)>td:nth-child(2)>span").replace("查看公司地图","");
jianjie = selectText("div[class=part2]").replace("公司介绍","");

 .css("ul[class=base_info]>li:nth-child(4)")


dizhi:   $$(".lxfs>ul>li:nth-child(1)>font")
youbian:   $$(".lxfs>ul>li:nth-child(2)>font")
lianxiren:   $$(".lxfs>ul>li:nth-child(3)>font")

youxiang:   $$(".lxfs>ul>li:nth-child(4)>font")

dianhua:   $$(".lxfs>ul>li:nth-child(5)>font")

chuanzheng:   $$(".lxfs>ul>li:nth-child(6)>font")

 CSS selectors for Selenium with example http://seleniumeasy.com/selenium-tutorials/css-selectors-tutorial-for-selenium-with-examples

原文地址:https://www.cnblogs.com/timssd/p/4740175.html