xpath

XSL substring and indexOf

人盡茶涼 提交于 2020-08-21 07:53:13
问题 I'm new to XSLT. I wonder if it is possible to select a substring of an item. I'm trying to parse an RSS feed. The description value has more text than what I want to show. I'd like to get a subtring of it based on the index of some substring. Basically, I want to show the result of a substring call passing indxOf('some_substring') and a length as parameters. Is this possible? From comments : I want to select the text of a string that is located after the occurrence of substring 回答1: It's not

Python Selenium: I am getting element is not attached to the page document error

萝らか妹 提交于 2020-08-20 14:20:23
问题 I am trying to build a scraper using selenium package for python but I am getting this error: Message: stale element reference: element is not attached to the page document (Session info: headless chrome=83.0.4103.61) I am using google colab. My code is: import selenium driver = webdriver.Chrome('chromedriver',chrome_options=chrome_options) titles=[] for link in links: driver.get(link) data = driver.find_elements_by_xpath('.//a[@class = "question-hyperlink"]') titles.append(data[0].text) The

Python - Tor Browser through Firefox, unable to click button

試著忘記壹切 提交于 2020-08-17 08:20:51
问题 So i have been trying to access a certain site (dumpert.nl) through Tor Browser as proxy via Firefox. The reason I am using Tor Browser is so I can enter the website with a different IP address every time I enter the website. I know this is possible but I have not yet found the way to do this. I have found multiple ways to do this, but they have not (yet) worked for me. Help is wanted on this part aswell. The real problem is I am having trouble with the Accept Cookie page of this website.

Chrome 84 Inspect element, find results not highlighted in yellow like before

时光怂恿深爱的人放手 提交于 2020-08-15 04:53:24
问题 As per usual when making automated tests I use "Inspect"(CTRL+SHIFT+I) in Chrome to find element by xpath, id, CSS selector etc. For example: //li/a[contains(text(), "Products")] Above is an xpath from this page. In previous versions of Chrome in "DevTools"/"Elements" after pressing CTRL+F to open the "Find" option and pasting this xpath element is highlighted in DevTools window. In new version of chrome it is not highlighted, the usual "1/1" results is displayed in far right of the "Find"

Chrome 84 Inspect element, find results not highlighted in yellow like before

旧街凉风 提交于 2020-08-15 04:53:12
问题 As per usual when making automated tests I use "Inspect"(CTRL+SHIFT+I) in Chrome to find element by xpath, id, CSS selector etc. For example: //li/a[contains(text(), "Products")] Above is an xpath from this page. In previous versions of Chrome in "DevTools"/"Elements" after pressing CTRL+F to open the "Find" option and pasting this xpath element is highlighted in DevTools window. In new version of chrome it is not highlighted, the usual "1/1" results is displayed in far right of the "Find"

Element not being clicked even though it is found using Selenium

送分小仙女□ 提交于 2020-08-10 20:14:48
问题 I'm trying to click on an element (radio button) using Selenium (in Python), I can't disclose the URL because it's a private corporate intranet, but will share the relevants part of code. So basically this element is within an iframe, thus, I've used the following code to get the element: # Select the item on main DOM that will udpate the iframe contents wait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//*[@id='sm20']"))).click() # Don't sleep, but only WedDriverWait... wait

Element not being clicked even though it is found using Selenium

北城余情 提交于 2020-08-10 20:13:07
问题 I'm trying to click on an element (radio button) using Selenium (in Python), I can't disclose the URL because it's a private corporate intranet, but will share the relevants part of code. So basically this element is within an iframe, thus, I've used the following code to get the element: # Select the item on main DOM that will udpate the iframe contents wait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//*[@id='sm20']"))).click() # Don't sleep, but only WedDriverWait... wait

Get Parent Attribute/Inheritance if Childnotes missing Attribute

ぐ巨炮叔叔 提交于 2020-08-10 19:34:32
问题 i want to get from my relevant Nodes all Attributes i can get. Problem is some Childnotes inherit from Parents or Global. What i want is if Childnotes attribute is missing i want it from parent or global. Tried several things nothing worked like (/ancester::) could someone help me? My Code for all Nodes: Sub GetAllNodes_V4_8() Dim XmlNamespaces As String Dim xmlDoc As MSXML2.DOMDocument60 Dim xmlNodes As MSXML2.IXMLDOMNodeList Dim xmlAttribute As MSXML2.IXMLDOMAttribute Dim node As MSXML2

lxml xpath expression for selecting all text under a given child node including his children

拜拜、爱过 提交于 2020-08-10 19:17:50
问题 Provided I have a XML as follows: <node1> <text title='book'> <div chapter='0'> <div id='theNode'> <p xml:id="40"> A House that has: <p xml:id="45">- a window;</p> <p xml:id="46">- a door</p> <p xml:id="46">- a door</p> its a beuatiful house </p> </div> </div> </text> </node1> I would like to locate text title and get all the text from the first p tag appearing inside the text title book node so far I know: from lxml import etree XML_tree = etree.fromstring(XML_content,parser=parser) text =

XPath 3 in browser

青春壹個敷衍的年華 提交于 2020-08-08 05:17:25
问题 When we see conformance chart, such as https://caniuse.com/#search=xpath and https://developer.microsoft.com/en-us/microsoft-edge/platform/status/domlevel3xpath/?q=xpath, it's usually about DOM Level 3 XPath that focuses on accessing DOM object using XPath 1.0 , but not necessarily XPath 3.0 or higher. Question 1 - Is there any explicit version requirement for browsers by W3C etc. to support newer versions of XPath? This XPath 1.0 feature works: document.evaluate( 'normalize-space(" X ")',