Python 3.11
Selenium 4.38
For the following URL:
https://www.amazon.es/-/en/Womens-Lace-up-Comfortable-Anti-Slip-SDMB2203W/dp/B0B5CX9VZY
On the right hand side of the page it says "Dispatches From" and "Amazon".
I'm writing a Selenium script to try to find pages where that field doesn't say Amazon, however Selenium cannot find that element in order to read it.
Class: a-size-small offer-display-feature-text-message << that space in 'small offer' causes a compound class name error, which does not resolve by inserting a period.
CSS Selector: #fulfillerInfoFeature_feature_div > div.offer-display-feature-text.a-size-small > div.offer-display-feature-text.a-spacing-none.odf-truncation-popover > span << does not find element.
XPath: '//\*\[@id="fulfillerInfoFeature_feature_div"\]/div\[2\]/div\[1\]/span' << does not find element.
Full XPath: /html/body/div\[1\]/div\[1\]/div/div\[2\]/div\[2\]/div\[2\]/div/div/div\[2\]/div\[5\]/div/div\[1\]/div/div/div/form/div/div/div/div/div\[4\]/div/div\[21\]/div/div/div\[1\]/div/div\[2\]/div\[2\]/div\[1\]/span << does not find element.
There doesn't appear to be a relevant iframe in play (there are iframes but I don't see that they apply to this element), and I don't see any shadow DOM.
How can I grab this element via Selenium?
EDIT: Request for more code. Below are many of the things I have tried:
dispatch = driver.find_element(By.CLASS_NAME,'a-size-small offer-display-feature-text-message')
dispatch = driver.find_element(By.CLASS_NAME,"span.a-size-small.offer-display-feature-text-message")
dispatch = driver.find_element(By.CLASS_NAME, "'a-size-small offer-display-feature-text-message'")
dispatch = driver.find_element(By.CSS_SELECTOR,"#fulfillerInfoFeature_feature_div > div.offer-display-feature-text.a-size-small > div.offer-display-feature-text.a-spacing-none.odf-truncation-popover > span")
dispatch = driver.find_element(By.XPATH,"//span[contains(text(), 'Amazon')]")
dispatch = driver.find_element(By.CSS_SELECTOR,"span.div.offer-display-feature-text.a-spacing-none.odf-truncation-popover")
dispatch = driver.find_element(By.XPATH,'//*[@id="fulfillerInfoFeature_feature_div"]/div[2]/div[1]/span')
dispatch = driver.find_element(By.XPATH,'//*[@id="merchantInfoFeature_feature_div"]/div[2]/div[1]/span')
dispatch = driver.find_element(By.XPATH,"/html/body/div[1]/div[1]/div/div[2]/div[2]/div[2]/div/div/div[2]/div[5]/div/div[1]/div/div/div/form/div/div/div/div/div[4]/div/div[21]/div/div/div[1]/div/div[2]/div[2]/div[1]/span")
EDIT 2: My comments button on answers isn't working (I think it's a low karma thing) - to respond to @Corey Goldberg, I tried both of those suggestions and got the associated messages:
.a-size-small.offer-display-feature-text-message
Message: invalid selector: An invalid or illegal selector was specified
a-size-small offer-display-feature-text-message
Message: Compound class names are not allowed