0

I am having an issue in selenium. I have this xpath that is working well

//*[@id='info_country']//div[contains(@class,'ant-select-selection-selected-value')

and I try to change it and use css selector instead of xpath I write this code:

#info_country .ant-select-selection-selected-value ng-tns-c17-151 ng-star-inserted

and the consul not find the path

can someone advise this is the consul and I pointed the element I want to locate

enter image description here

1 Answer 1

1

ng-tns-c17-151 and ng-star-inserted are separate classes, you need to state it in the selector using .. Currently, the selector treats ng-tns-c17-151 and ng-star-inserted as tags

#info_country .ant-select-selection-selected-value.ng-tns-c17-151.ng-star-inserted

The direct translation will be without those classes

#info_country .ant-select-selection-selected-value
Sign up to request clarification or add additional context in comments.

4 Comments

If I am in the consul and want to get the text. How do I do it? #info_country .ant-select-selection-selected-value.text() #info_country .ant-select-selection-selected-value/text() not worked
@Bastian Use a variable and textContent a = $("#info_country .ant-select-selection-selected-value")[0] a.textContent
Not in the java code, I want to test it in the F12 chrome consule
@Bastian Yes, I know. This is for the console.

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.