0

Can someone help me to extract the id text (the underline one in the below-attached image) from this link: https://opennem.org.au/facilities/au/?selected=DEIBDL&status=operating,committed,commissioning,retired

To get the right on the item in any of the items in the table and inspect.

enter image description here

I knew how to extract the table text but I want the id text which I underlined

1 Answer 1

1

The selected element can be located by this XPath

//div[@class='card is-selected']

Or this CSS Selector

div.is-selected

So, you can use this Selenium code to extract the id attribute value:

id = driver.find_element(By.XPATH,"//div[@class='card is-selected']").get_attribute("id")

But this will give you the id appearing on the dev tools, this is not always the text you see as a user on the page. To get the text user sees you will need this:

name = driver.find_element(By.CSS_SELECTOR,"div.is-selected .station-name").text

This can be done woth XPath as well

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.