Skip to content
Advertisement

Tag: xpath

Python and LXML: extremely slow, more efficient code?

I’m processing XML documents like the following. I’m using the following code to change the attributes of certain elements whenever certain conditions are met. The code works as expected and I’m getting the output I want. However the time it takes to process all the files seems way too much. If you notice, I have some print statements that allow

xpath inside founded elements using selenium

I found 10 elements using: Then i’m trying get information from collected divs by xpath in cycle: But always i get first element Question: Is it possible to get information from each block in cycle using relative xpath with already founded element by selenium? One of divs HTML: Answer Yes, you can easily find each block data using relative xpath

How to press button?

I’m pretty new with the selenium module in python and I’m not able to press a button. Here the HTML-Code: Here’s a minimal example: what am I doing wrong? Context I want to automatically select the language of the website. Answer It seems to be your locator strategy is correct. You can shorten your xpath expression as follows:

How to interact with interactive elements inside iframe using Selenium

How can I interact with the ddlDelegacion (dropdown menu) element in this webpage using selenium webdriver for python? I´m doing this to periodically download some (periodically updated) documents from a government webpage for my family The HTML code is this My approach is this: However it raises this exception: If i don´t use the driver.switch_to_frame it throws this exception despite

Getting text from a object with Selenium

I’m trying to get the text inside of <pre> tag and I have tried with get_attribute(‘text’), get_attribute(‘value’), .text(), .value(), get_attribute(“innerHTML”) but I keep failing: Snapshot: This is the code that i’m using: And this is what it says when print: Answer To print the text within the <pre> tag you can use either of the following locator strategies: Using css_selector

Advertisement