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
Tag: xpath
Selenium: Iterate through child elements with different class names
I want to iterate through child elements of parent . Access the child element, extract price information and move on to next child element. Here is my code Output: Concern/What I want help with: Price output should change in each iteration as element changes. But I am only getting same price as first element price Desired Output: HTML outer element
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
How to interact with the button using Selenium webdriver and Python
I want to try filling out the form on this page: https://konzinfoidopont.mfa.gov.hu. However, when I try to select the dropdown menu and click it, I get the following error: This is the mentioned button: And my code yet: Answer The desired element is within a Modal Dialog Box, so to click on the clickable element you need to induce WebDriverWait
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
How to extract the values of the alt atributte within img with selenium python
I have the following problem, I haven’t been able to solve it. I have to extract the text that appears in an alt attribute of an image. The id always changes, as does the contained alt. I noticed that the id only changes in this part Anyway, I am still unable to log in. Answer To extract and print the
Problem with accessing XML-attributes via xpath
I have some XML that consists of a lot of repitions of the following xml-structure: Able to adress most of the elements and extract the information within, but failing to get to the specific ones where I have to define the attribute as well. I think I am struggling with the xpath, but can’t quite figure out, why. If I
Selenium cant find element on Javascript page
I am still quite new to python and selenium, However have managed to get quite far with what I am doing. But I appear to now be stuck. The page in question is an internal business page. I have tried using ID, name and XPATH with very little success. The problem I am having is with the filter, I think