I am currently working on a program that logs into an account for me and navigates through some webpages
My current issue is that on one of the webpages, I cannot click ANY hyperlink buttons to get to the next page I need to get to. I have tried finding the element waiting to see if it is clickable and using:
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.LINK_TEXT, ""))).click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.PARTIAL_LINK_TEXT, ""))).click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CLASS_NAME, ""))).click()
and
driver.find_element(By.XPATH, "").click()
(Along with the other methods)
However, I have had no success when I invoke a .click()
after each of those.
After further investigation, I saw that the website uses the same class name for 2 of the elements. I am not sure if this plays any role into not being able to click on the one I need to.
- Element which I am trying to click:
<a href="/prod/twbkwbis.P_GenMenu?name=bmenu.P_StuMainMnu" class="submenulinktext2 " onmouseover="window.status='Student'; return true" onmouseout="window.status=''; return true" onfocus="window.status='Student'; return true" onblur="window.status=''; return true">Student</a>
The XPATH: /html/body/div[4]/table[1]/tbody/tr[2]/td[2]/a
- Element with the same class name as the one above:
<a href="/prod/twbksite.P_DispSiteMap?menu_name_in=bmenu.P_MainMnu&depth_in=2&columns_in=3" accesskey="2" class="submenulinktext2">SITE MAP</a>
The XPATH: /html/body/div[2]/table/tbody/tr/td[2]/p/span/a[2]
After seeing them both having the same class name, I tried:
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "a.submenulinktext2"))).click()
A thought I was that since the automation is going from one website URL and navigates to another page with a new URL to begin more navigation, that it did not know what URL we were on so I tried:
driver.get("NEW URL")
And with that in place there has been no success so far, unfortunately. Any guidance on how I can go about this would be appreciated!