xpath

How do we get the Longest Booking in XPATH 1.0?

。_饼干妹妹 提交于 2020-04-17 20:17:25
问题 How can I get the name of the person who has the longest Booking using the attribute StartDate and EndDate belwo i menioned the xml dummy data i have like 12 diffrent datas and more people , the version i am using for xpath is 1.0 <rent number="101111"> <car> <startDate>2018-02-08</startDate> <endDate>2018-03-05</endDate> <Location>Toranto</Location> <carType>BMW</carType> <transmissionType>Automatic</transmissionType> </car> <person> <licenseNumber> 02389749372 </licenseNumber> <name>Alexa

How do we get the Longest Booking in XPATH 1.0?

为君一笑 提交于 2020-04-17 20:16:27
问题 How can I get the name of the person who has the longest Booking using the attribute StartDate and EndDate belwo i menioned the xml dummy data i have like 12 diffrent datas and more people , the version i am using for xpath is 1.0 <rent number="101111"> <car> <startDate>2018-02-08</startDate> <endDate>2018-03-05</endDate> <Location>Toranto</Location> <carType>BMW</carType> <transmissionType>Automatic</transmissionType> </car> <person> <licenseNumber> 02389749372 </licenseNumber> <name>Alexa

Find by xpath for multiple td tags

泄露秘密 提交于 2020-04-17 18:58:11
问题 I would like to download PDF files from this website https://www.asx.com.au/asx/statistics/prevBusDayAnns.do if two conditions are met. The first condition is that the 'ASX Code' has to match one of the codes in a list. The second condition is that the 'Headline' has to match 'Change in substantial holding'. My current code only finds by xpath if the 'ASX Code' = 'SPL'. An example of what I am trying to achieve: data1 = ['SPL', 'WBC', 'AAA'] WebDriverWait(driver,20).until(EC.element_to_be

for a parent Element, there are two child Elements. If .text() of child 1 matches, how to perfomr action on Child2

时间秒杀一切 提交于 2020-04-11 17:59:07
问题 THe element is defined like this: <div class ="frm-group'> <label class ="ng.binding" "Source Environment" ..... </label> <select class "ng-touched" ...... </select> </div> <div class ="frm-group'> <label class ="ng.binding" "Target Environment" ..... </label> <select class "ng-touched" ...... </select> </div> Div class is the parent class and "lable" and "select" class is the child class. Problem Statement : I have to do the following :: If the Label.getText() matches with a string, then

scrapy Selector用法及xpath语法

情到浓时终转凉″ 提交于 2020-04-07 17:14:44
准备工作 html示例: <?xml version="1.0" encoding="UTF-8"?> <html <head> <title>text</title> </head> <body> <div class="cdiv"> <p class="cp1 section">test p1 <span>next p1</span></p> <ul> <li id="0">1</li> <li id="1">2</li> <li id="2">3</li> </ul> </div> <div class="cdiv1"> <p class="cp2">test p2 <span>next p2</span></p> <ul> <li id="3">4</li> <li id="4">5</li> <li id="5">6</li> </ul> </div> <p class="item">test in p </p> <li id="6" class="item cli-1">7</li> <li id="7" class="item cli-2">8</li> </body> </html> 把该示例保存到test.html中. 创建python文件,输入代码 from scrapy.selector import Selector doc = '' with open('

Why is CROSS APPLY needed when using XPath queries?

早过忘川 提交于 2020-04-07 11:26:32
问题 tl;dr Why doesn't: SELECT SomeXmlColumn.nodes('/people/person') AS foo(b) FROM MyTable work? The Before Question Nearly ever answer I've seen (or gotten) for using XPath queries in SQL Server requires that you join the XML document back to itself using a CROSS APPLY . Why? For example: SELECT p.value('(./firstName)[1]', 'VARCHAR(8000)') AS firstName, p.value('(./lastName)[1]', 'VARCHAR(8000)') AS lastName FROM table CROSS APPLY field.nodes('/person') t(p) For example: SELECT a.BatchXml.value(

Selenium Webdriver finding an element in a sub-element

偶尔善良 提交于 2020-04-07 10:53:45
问题 I am trying to search for an element in a sub-element with Selenium (Version 2.28.0), but selenium des not seem to limit its search to the sub-element. Am I doing this wrong or is there a way to use element.find to search a sub-element? For an example I created a simple test webpage with this code: <!DOCTYPE html> <html> <body> <div class=div title=div1> <h1>My First Heading</h1> <p class='test'>My first paragraph.</p> </div> <div class=div title=div2> <h1>My Second Heading</h1> <p class=

UI自动化

℡╲_俬逩灬. 提交于 2020-04-07 08:02:10
selenium: ide -录制 webdriver -库 提供了网页的操作方法 pip3 install -U selenium 安装:ie-ieserberdriver chrome-chromedriver firefox-geckodriver 浏览器驱动:http://npm.taobao.org/mirrors/chromedriver/ 驱动版本与浏览器需要匹配,最好关闭浏览器更新功能 通信流程: 1.xxxdriver(浏览器驱动)启动,ip+端口监听 2.python selenium webdriver跟浏览器驱动建立链接,发送http请求 3.浏览器驱动收到指令,驱动浏览器做操作 4.浏览器驱动把结果返回给 python selenium webdriver 5.继续发下一个http请求 6.最后断开链接,关闭驱动,关闭浏览器 定位方式: 1.根据元素属性来查找元素: id name class_name 只支持一个class值 tag_name 2.只针对a元素: link_text partial_link_text 3.多个属性组合查找元素: xpath css_selector from selenium import webdriverimport time# 启动Chrome浏览器driver = webdriver.Chrome()#

使用Python的Scrapy框架编写web爬虫的简单示例

三世轮回 提交于 2020-04-07 04:53:55
在这个教材中,我们假定你已经安装了Scrapy。假如你没有安装,你可以参考这个 安装指南 。 我们将会用 开放目录项目(dmoz) 作为我们例子去抓取。 这个教材将会带你走过下面这几个方面: 创造一个新的Scrapy项目 定义您将提取的Item 编写一个 蜘蛛 去抓取网站并提取 Items 。 编写一个 Item Pipeline 用来存储提出出来的Items Scrapy由 Python 写成。假如你刚刚接触Python这门语言,你可能想要了解这门语言起,怎么最好的利用这门语言。假如你已经熟悉其它类似的语言,想要快速地学习Python,我们推荐 这种深入方式学习Python 。假如你是新手,想从开始使用Python学习,可以尝试去看看非程序员 Python资源列表 。 创造一个项目 在你要抓取之前,首先要建立一个新的Scrapy项目。然后进去你的存放代码目录,执行如下命令。 scrapy startproject tutorial 它将会创建如下的向导目录: 复制代码 代码如下: tutorial/ scrapy.cfg tutorial/ __init__.py items.py pipelines.py settings.py spiders/ __init__.py ... 这是一些基本信息: scrapy.cfg: 项目的配置文件。 tutorial/:

How to perform case insensitive search in XPath?

前提是你 提交于 2020-04-07 02:24:56
问题 I am trying to implement case insensitive search using XPath. I have already referred how to perform a case-insensitive attribute selector in xquery so please check before marking as duplicate. I am using Lcase to convert my variable ( L_search ) to lowercase and lower-case functions. My original case sensitive XPath expression is: XPath = "//*[contains(., '"& search &"')]/ancestor-or-self::*/*[local-name()='home' and @locale='en']" I have tried many combinations like : XPath = "//*lower-case