How to address the error AttributeError: 'NoneType' object has no attribute 'click'
? Its failing in self.home.get_you_button().click()
. It’s working fine when I am not creating Page Object Class...it clicks on the You button without any error but by using POM it’s failing. The url is https://huew.co/
Code trials:
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
class HomePage():
def __init__(self,driver):
self.driver = driver
def wait_for_home_page_to_load(self):
wait =WebDriverWait(self.driver,30)
wait.until(expected_conditions.visibility_of(self.driver.find_element_by_tag_name('html')))
def get_you_button(self):
try:
element = self.driver.find_element_by_xpath("//div[@class='desktop-public-header']/a[@ng-controller='UserNavigationInteractionCtrl'][6]")
except:
return None