1

I'm doing an automation to search a certain process on a website and collect information. When requesting data collection, it returns the following error: "Selenium Python: Invalid Selector in find_element_by_css_selector"

this is my code: chrome.find_element_by_css_selector('#31円 641215964292-0-uiGrid-003J-cell > div').text

This is the page source in the website: enter image description here

In yellow is the data I need to extract.

The id "31円" appears to contain the wrong value. But in that case how can I extract the data like this?

I would like to know the reason and solution.

Thanks for your time.

Please help me.

asked Jan 3, 2022 at 13:49
2
  • remove the css tag, it implies that you need help with styling Commented Jan 3, 2022 at 14:36
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. Commented Jan 3, 2022 at 14:54

2 Answers 2

1
elem=chrome.find_element(By.XPATH,"//div[@class='ui-grid-canvas']/div[2]/div/div/div").text

Would get you the first element with that number. It doesn't look like they have any unique identifiers except maybe the ui grid cell id.

answered Jan 4, 2022 at 20:46
Sign up to request clarification or add additional context in comments.

Comments

1

Try this css:

find_element_by_css_selector(".ui-grid-cell-contents .ng-binding .ng-scope")

If it's still not working, you can use xpath to check selenium can actually locate the element.

answered Jan 3, 2022 at 15:01

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.