I am trying to scrape from a mouseover hoverable element in python selenium. However, I get the error NameError: name 'campaign_link' is not defined. I am getting the feeling that I do not select the right element, but I have tried several and still can't click on the link element inside the hover element. This is my code:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver import ActionChains
# Specify driver
fp = webdriver.FirefoxProfile()
fp.set_preference("network.cookie.cookieBehavior", 2)
driver = webdriver.Firefox(firefox_profile=fp)
wait = WebDriverWait(driver,10)
driver.get('https://www.indiegogo.com/projects/flash-pro-world-s-fastest-powerbank-redesigned#/')
campaign_info = driver.find_element_by_css_selector(".basicsCampaignOwner-details-name > span:nth-child(1) > span:nth-child(1) > div:nth-child(1)")
campaign_box = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, ".tooltipHover-hoverContent-body > div:nth-child(1)")))
campaign_link = wait.until(EC.element_to_be_clickable(By.CSS_SELECTOR,".tooltipHover-hoverContent-body > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > a:nth-child(4)"))
actions=ActionChains(driver)
actions.move_to_element(campaign_info).move_to_element(campaign_box).move_to_element(campaign_link).click().perform()
It should go to the campaign owner webpage, but it stays on the campaign webpage. What am I doing wrong here? Could someone help me please?