I am trying to click on the rate button to set the rating for episode one of Atlanta season four on the IMDB website as illustrated by the image further below.
I have tried various combinations of selenium xpath values and have googled various links to attempt to achieve this, but can't remember which now. My current python is below.
driver.get('https://www.imdb.com/title/tt4288182/episodes/?ref_=tt_ov_epl')
xpath = './/*[@class="list_item odd"]|.//*[@class="list_item even"]'
div = driver.find_element(By.XPATH, xpath)
xpath = './/*[@class="ipl-rating-star ipl-rating-interactive__star--empty"]'
div2 = div.find_element(By.XPATH, xpath)
selector = "spam>svg>path"
class2 = div2.find_element(By.CSS_SELECTOR, selector)
The div variable is assigned as I want with a single element; but the python fails to find the attribute value 'ipl-rating-star ipl-rating-interactive__star--empty' , though it can be seen in the html copied from the web page below:
<div class="ipl-rating-star ipl-rating-interactive__star--empty ">
<span class="ipl-rating-star__star">
<svg class="ipl-icon ipl-star-border-icon " xmlns="http://www.w3.org/2000/svg" fill="#000000" height="24" viewBox="0 0 24 24" width="24">
<path d="M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"></path>
<path d="M0 0h24v24H0z" fill="none"></path>
</svg>
</span>
<span class="ipl-rating-star__rating">Rate</span>
</div>
The python currently produces this error message: selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":".//*[@class="ipl-rating-star ipl-rating-interactive__star--empty"]"} (Session info: chrome=105.0.5195.127)
I am also using PyCharm 2022.2.2 Build #PC-222.4167.33 with Python 3.10.7

