I am attempting to create an if else statement that checks for the existence of a specific CSS element.
If the first CSS element does not exist, it should then click on the second CSS element.
Here is my current code:
#IF STATEMENT
driver.find_element_by_css_selector('.GA_Track_Action_Download-FullHD-1080p > .movieQuality').click()
#ELSE STATEMENT
driver.find_element_by_css_selector('.GA_Track_Action_Download-4K-2160p > .movieQuality').click()
This is what I've attempted:
if is_element_exist(driver, '.GA_Track_Action_Download-FullHD-1080p > .movieQuality''):
driver.find_element_by_css_selector('.GA_Track_Action_Download-FullHD-1080p > .movieQuality').click()
else:
driver.find_element_by_css_selector('.GA_Track_Action_Download-4K-2160p > .movieQuality').click()
However, this solution does not seem to be working as expected.