xpath

How to configure a “hello world” HTML page using BaseX with RestXQ?

人盡茶涼 提交于 2021-01-29 16:42:53
问题 More of a usage question than a programming question, in relation to: BaseX RESTXQ "hello world" example How do I use RESTXQ with BaseX for a simple web app? basex/rest - blog complete app Is there a way to make BaseX serve an HTML document? Certainly, it's easy enough to fork the blog app. However, it's also eight years old. The sample from the documentation is: module namespace page = 'http://basex.org/examples/web-page'; declare %rest:path("hello/{$who}") %rest:GET function page:hello($who

Code using lxml and xpath works on single xml file, but fails when this is extended to a collection of similar xml

ε祈祈猫儿з 提交于 2021-01-29 15:07:51
问题 When parsing a single xml file to find a specific named node and it's text, I can get output as desired. However, I need to extend this code to a collection of xml files. When I do so, I get no output. Here is my code on a single xml file, which works as desired: from lxml import etree parsed_single = etree.parse('Downloads/one_file.xml') xp_eval =etree.XPathEvaluator(parsed_single) d = dict((item.text, item.tag) for item in xp_eval('//node_of_interest')) The above code outputs the following,

Click on ember.js enabled element using Selenium

℡╲_俬逩灬. 提交于 2021-01-29 12:46:34
问题 I am trying to click on the following button on a linkedin page using selenium : <button id="ember607" class="share-actions__primary-action artdeco-button artdeco-button--2 artdeco-button--primary ember-view" data-control-name="share.post"><!----> <span class="artdeco-button__text"> Post </span></button> I have tried to use: driver.find_element_by_id , but the id of the button seems to keep changing number driver.find_element_by_xpath , but this contains the button number, so also fails

How to extract all <li> elements under <ul>

大兔子大兔子 提交于 2021-01-29 12:29:15
问题 I want to extract all <li> element text that are under <ul> for which I tried elem = driver.find_elements_by_xpath(("//div[@class='left width50']/p/b/ul")) len(elem) gives '0' or empty list. here is the html source <div class="left width50"> <p><b>Features:</b></p> <ul> <li>Easy spray application</li> <li>Excellent bonding properties</li> <li>Single package</li> <li>Mixed with clean potable water at job site</li> </ul> </div> HERE is the link of the website How to go about it any suggestions?

Import table using IMPORTXML

点点圈 提交于 2021-01-29 10:59:23
问题 I am trying to pull the table from https://rotogrinders.com/schedules/nfl into Google Sheets I tried using ImportHTML("https://rotogrinders.com/schedules/nfl", "table", 1) but it just returns the header: Time Team Opponent Line Moneyline Over/Under Projected Points Projected Points Change Using ImportXML, I tried IMportXML("https://rotogrinders.com/schedules/nfl","//tr"), but it returns the same header and no data. I dont think the tbody needs authentication to access. I logged out, cleared

XPath Selecting value of an XML node based on multiple conditions

北城余情 提交于 2021-01-29 10:35:47
问题 The following XML represents a simplified version of a more complex structure that I am working with. I want to be able to select a specific value based on some meta data. <Root> <Data> <KeyValuePair> <Key>Field1</Key> <Value>Value1</Value> </KeyValuePair> <KeyValuePair> <Key>Field2</Key> <Value>Value2</Value> </KeyValuePair> <KeyValuePair> <Key>Field3</Key> <Value>Value3</Value> </KeyValuePair> </Data> <Name>Customer</Name> <ID>00000000-0000-0000-0000-000000000000</ID> </Root> I want to be

How to extract the corresponding text of a Div via xpath?

余生颓废 提交于 2021-01-29 09:41:11
问题 While making xpath to extract data out of the below given HTML nodes, I'm unable to extract the corresponding text from corresponding elements within a Div. <div class="Main"> <div class="Sub"> <div class="Birth">Jack</div> <span class="Date"> <div><span class="Date">6 June 2018</span></div></span></div> <div class="Sub"> <div class="Birth">Hurley</div> <span class="Date"><div><span class="Date">21 June 2011</span></div></span></div> <div class="Sub"> <div class="Birth">Kate</div> <span class

Add variable in XPath in Python

泪湿孤枕 提交于 2021-01-29 09:13:10
问题 While doing automation, I have to check that email which I am entering is correct one or not. Unfortunately, while creating XPath, UIAutomator is showing me the text of my email address. I want to make XPath dynamic, so, that every time, I use that XPath, It gets the text. Let us suppose: email = 'testqatp@gmail.com' and XPath is: [@text='email'] How is that gonna work? 回答1: if are talking about an input maybe an xpath like this xpath='//input[text()="'+email'"]' give it a go :) 回答2: The

What is the significance of the attribute xpath=“1” while constructing locators for Selenium tests

不羁的心 提交于 2021-01-29 08:46:00
问题 Recently I stumbled on an element with an attribute xpath="1" within an angular based application. HTML: I'm unable to find any details about this attribute and it's possible impact and usage within a xpath/cssSelector for the Selenium based tests. Can anyone help me out in any directions please? 回答1: That attribute (xpath="1") is placed there by a browser extension named CHROPATH. It is provided by a feature they call Dynamic Attribute Support . Scolling down the page one will find a text

Unable to locate element | xPath | Selenium Webdriver

旧城冷巷雨未停 提交于 2021-01-29 08:31:24
问题 I am trying to reference and then click an element on a web page. This is the web page: https://www.facebook.com/settings This is the element: <div class="linkWrap noCount">Notifications <span class="count _5wk0 hidden_elem uiSideNavCountText">(<span class="countValue fsm">0</span><span class="maxCountIndicator"></span>)</span></div> It's a DIV which contains the word "Notifications" We should be able to reference with a simple xPath. Such as //div[contains(text(), 'Notifications')] However,