For clicking a button with the following HTML code:
JavaScript
x
2
1
<a href="javascript:submitPage('V','All Notes','');" class="viewFilter">All Notes</a>
2
I have tried multiple ways to click/ access this button but to no success, for example:
JavaScript
1
4
1
all_notes = wait.until(EC.presence_of_element_located((By.XPATH, "//a[@href='javascript:submitPage('V','All Notes','');']"))).click()
2
3
all_notes = wait.until(EC.presence_of_element_located((By.XPATH, "//href[@type='class' and @value='View All']"))).click()
4
I am not really sure what the issue is here – for all other button presses on this webpage – selenium has been working appropriately. What other ways can I try?
Advertisement
Answer
JavaScript
1
3
1
all_notes = WebDriverWait(driver,10).until(EC.presence_of_element_located(
2
(By.XPATH, '//*[@href="javascript:submitPage('V','All Notes','');"]'))).click()
3
escape the single quotes