Replies: 2 comments 5 replies
-
Use a better selector, eg: self.get_text('span div:contains("Number of rooms")') Output: Not all XPath selectors can be converted into CSS Selectors. When you can specify the selector |
Beta Was this translation helpful? Give feedback.
1 reply
-
Why these is no support of XPath selectors, which are more powerful and generic than CSS selectors? selenium driver supports XPath just fine, I have large tests which use it. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dear Michael,
I have tried some ways to gather a specific element using the "find_element() function". Using this function only give us the power to use the CSS SELECTOR because inside the source code you have hardcoded by= as "CSS_SELECTOR" so I cannot pass inside the BY.XPATH. Later I discovered the method that converts xpath to css selector. The code I have written looks like this :
However, the code gives an Exception of "cannot convert xpath to css.." How can I use XPATHs with Selenium Base Case methods.
What really I am trying to gather is in this site :
https://www.agoda.com/radisson-blu-hotel-istanbul-ottomare/hotel/istanbul-tr.html?finalPriceView=2&isShowMobileAppPrice=false&cid=1922882&numberOfBedrooms=&familyMode=false&adults=2&children=0&rooms=1&maxRooms=0&checkIn=2024-07-29&isCalendarCallout=false&childAges=&numberOfGuest=0&missingChildAges=false&travellerType=1&showReviewSubmissionEntry=false¤cyCode=EUR&isFreeOccSearch=false&tag=c4254dc2-e34a-491c-9db8-aeb463b931f1&tspTypes=8&los=1&searchrequestid=4b4d1719-2bc8-411b-bf4b-3ddb699f8516&ds=RHvlky7lTy%2BZYUYU
Here I am trying to gather the number of the "Number of rooms : 133" with Selenium Base function when I am crawling. Please enlighten me about this. And maybe you can help me giving an example code you can construct please..

Thank you very much for your help!!
Beta Was this translation helpful? Give feedback.
All reactions