I'm trying to click on a button that expands on click but selenium is unable to locate the element. The element identified seems to be correct. I am using the Page Object Model here.
I tried to first simply find the element and click on it and then also tried to use ActionChains. Tried changing the element value and the methods of identifying such as ID, XPath, CSS Selector but nothing seems to work.
HTML:
<tr style="border-top:1px solid #e6e6e6;"><td style="display:inline-block;"><div class="expand"><i id="expand_2971740_2086074" class="fa fa-plus-circle" onclick="" style="display: block;"></i><i style="display: none;" id="collapse_2971740_2086074" class="fa fa-minus-circle" onclick="closeBundleCourses(2971740,2086074)"></i></div></td><td class="text-center">Course1Jan</td><td class="text-center">19-06-2019</td><td class="text-center">0</td><td class="text-center">1</td></tr>
Code trials:
click_plus_button = 'expand_2971740_2086074' #id
def __init__(self,driver):
self.driver = driver
def enroll_user(self,firstname,lastname,email):
self.driver.find_element_by_link_text(self.go_to_manage_users).click()
self.driver.find_element_by_class_name(self.expand_manage_users).click()
time.sleep(2)
actions = ActionChains(self.driver)
actions.move_to_element(self.driver.find_element_by_id(self.click_plus_button)).click().perform()
self.driver.find_element_by_id(self.manage_users_firstname).send_keys(manage_users_firstname)
self.driver.find_element_by_id(self.manage_users_lastname).send_keys(manage_users_lastname)
self.driver.find_element_by_id(self.manage_users_email).send_keys(manage_users_email)
Expected Result:
Actual Result: