xpath

More direct way to create list of dataframes from XML file?

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-08 10:40:27
问题 SDMX (Statistical Data and Metadata Exchange) is a 'XML' grammar that defines a standard for exchanging statistical data. It uses files called Dataset Structure Definition Description (DSD) to convey the structure of a dataset. Amongst other things the DSD contains a node Codelists that is comprised of the Codelist items which in turn are parent to the Code and Name item and attribuet. I am currently trying to parse these Codelists of a DSD file requested from Eurostats REST interface into a

Scrapy Extract ld+JSON

吃可爱长大的小学妹 提交于 2021-02-08 09:48:20
问题 How to extract the name and url? quotes_spiders.py import scrapy import json class QuotesSpider(scrapy.Spider): name = "quotes" start_urls = ["http://www.lazada.com.my/shop-power-banks2/?price=1572-1572"] def parse(self, response): data = json.loads(response.xpath('//script[@type="application/ld+json"]//text()').extract_first()) //how to extract the name and url? yield data Data to Extract <script type="application/ld+json">{"@context":"https://schema.org","@type":"ItemList","itemListElement"

What does xpath=“1” mean in HTML?

浪子不回头ぞ 提交于 2021-02-08 08:52:47
问题 In my design code, the following is written. I cannot understand what xpath="1" means here. <select class="search-category" id="ddlTemp" name="Template" xpath="1"> <option value="">Select</option> <option value="a">a</option> <option value="b">b</option> </select> 回答1: In General There is no standard interpretation of xpath="1" in HTML because there is no standard xpath attribute on a select element (or any other HTML element). You've stumbled across some application's idiosyncratic markup;

How to use xpath for extracting text between <br/> tag

半世苍凉 提交于 2021-02-08 08:40:30
问题 Following is the code of a button in my application. <span class="ms-cui-ctl-largelabel" unselectable="on"> New <br> Map </span> </a> </span> I want to click on that button and using Selenium Webdriver for it. I tried multiple combinations but it's not working for me. Following are the different xpaths which I tried 1. By.xpath("//span[contains(@class, 'ms-cui-ctl-largelabel') and text() = 'New/nMap']")); 2. By.xpath("//span[contains(@class, 'ms-cui-ctl-largelabel') and text() = 'New/r/nMap']

how to retrieve data from html between <span> and </span>

笑着哭i 提交于 2021-02-08 07:50:05
问题 I want to get the rate that is from 1 to 5 in amazon customer reviews. I check the source, and find this part looks as <div style="margin-bottom:0.5em;"> <span style="margin-right:5px;"><span class="swSprite s_star_5_0 " title="5.0 out of 5 stars" ><span>5.0 out of 5 stars</span></span> </span> <span style="vertical-align:middle;"><b>Works great right out of the box with Surface Pro</b>, <nobr>October 5, 2013</nobr></span> </div> I want to get 5.0 out of 5 stars from <span>5.0 out of 5 stars<

how to retrieve data from html between <span> and </span>

天大地大妈咪最大 提交于 2021-02-08 07:49:00
问题 I want to get the rate that is from 1 to 5 in amazon customer reviews. I check the source, and find this part looks as <div style="margin-bottom:0.5em;"> <span style="margin-right:5px;"><span class="swSprite s_star_5_0 " title="5.0 out of 5 stars" ><span>5.0 out of 5 stars</span></span> </span> <span style="vertical-align:middle;"><b>Works great right out of the box with Surface Pro</b>, <nobr>October 5, 2013</nobr></span> </div> I want to get 5.0 out of 5 stars from <span>5.0 out of 5 stars<

Mouse the focus to an object using selenium python

孤街浪徒 提交于 2021-02-08 07:32:27
问题 I am automating a website using selenium RC and python 2.7 on Ubuntu Linux. Here is what I need to do: Go to the site http://borro.com. Scroll down to the bottom of the page using key down native command I need to hover the mouse on g +1 read the tool tip click on the name that appears in the tool tip. The problem I am having is -- I need the mouse to physically move there, wait for say 2 secs and then read the tool tip and click on the name The mouse is not physically moving there and I

Mouse the focus to an object using selenium python

半世苍凉 提交于 2021-02-08 07:30:31
问题 I am automating a website using selenium RC and python 2.7 on Ubuntu Linux. Here is what I need to do: Go to the site http://borro.com. Scroll down to the bottom of the page using key down native command I need to hover the mouse on g +1 read the tool tip click on the name that appears in the tool tip. The problem I am having is -- I need the mouse to physically move there, wait for say 2 secs and then read the tool tip and click on the name The mouse is not physically moving there and I

Selenium / lxml : Get xpath

六眼飞鱼酱① 提交于 2021-02-08 03:44:32
问题 Is there a get_xpath method or a way to accomplish something similar in selenium or lxml.html. I have a feeling that I have seen somewhere but can't find anything like that in the docs. Pseudocode to illustrate: browser.find_element_by_name('search[1]').get_xpath() >>> '//*[@id="langsAndSearch"]/div[1]/form/input[1]' 回答1: As there is no unique mapping between an element and an xpath expression, a general solution is not possible. But if you know something about your xml/html, it might be easy

Unable to locate element for LABEL with the XPath expression

妖精的绣舞 提交于 2021-02-08 01:54:21
问题 I am trying the below xpath for Label, but I'm not able to locate the element. driver.findElement(By.xpath("//div[label[contains(text(),'Patient's Name']]")).isEnabled(); XPath: .//*[@id='update_patient_profile']/div/div[1]/label ---Taken from FirePath. Below is the HTML source for the field. <form id="update_patient_profile" action="/subscriber/" method="post" name="update_patient_profile"> <div class="subscriberAddPatient"> <div class="formData nameInputs"> <label for="first_name">Patient's