My task is to locate the XPath for the section under “Main Lists” on this specific site. This is what I have so far:
//div[starts-with(@class, ('sm-CouponLink_Label'))]
However, this search yields 32 results...
`//div[starts-with(@class, ('sm-CouponLink_Label'))]`[contains(text(),'*')or[contains(Style(),'*')]
Unfortunately, in this particular case, I need to stick with XPaths and not CSS.
The website in question can be found here, my relevant code is available, and here's an accompanying image of the desired XPATH.
I've also experimented with the following:
CSS:
div:nth-child(1) > .sm-MarketContainer_NumColumns3 > div > div
Xpath equiv...:
//div[1]//div[starts-with(@class, ('sm-MarketContainer_NumColumns3'))]//div//div
But it doesn't seem to be effective.
UPDATED WORKING CSS:
div.sm-Market:has(div >div:contains('Main Lists')) * > .sm-CouponLink_Label
Xpath:
//div[Contains(@class, ('sm-Market'))]//preceding::('Main Lists')//div[Contains(@class, ('sm-CouponLink_Label'))]
Still not functioning correctly..
I'm uncertain if Selenium has a comparable feature to :has
Alternatively...
Something along the lines of:
//div[contains(text(),"Main Lists")]//following::div[contains(@class,"sm-Market")]//div[contains(@class,"sm-CouponLink_Label")]//preceding::div[contains(@class,"sm-Market_HeaderOpen ")]
(wrong area)