jeudi 4 mars 2021

Checkbox using xpath not accessible

I am trying to access a checkbox titled "Cooperative Agreement (968)" on a website (grants.gov). The URL is this.

It looks like there are two HTML elements on the HTML page. The second HTML is contained in #document.

I don't know what #document means, but I think it is where the issue is, because, I can get anything outside of #document, but nothing inside of it.

This is my current code:

driver.maximize_window()
driver.implicitly_wait(20)
driver.get('https://www.grants.gov/web/grants/search-grants.html')

time.sleep(3)
print('go')
cooperative_agreement = driver.find_element_by_xpath(
'/html/body/table[1]/tbody/tr/td[1]/div/div[1]/div/div/table/tbody/tr[2]/td/input')

print(cooperative_agreement.text)

I am using dev tools on chrome to get the XPath for everything. If you go to the URL and go to dev tools on chrome and try to get the XPath for the checkbox titled "Cooperative Agreement (968)" you will see the issue I am having.

This is my first question on StackOverflow. Please let me know if you need more info on something! Thank you all for your help!




Aucun commentaire:

Enregistrer un commentaire