I am currently facing issues while trying to select an element on a webpage using selenium. The element in question is expandable, and when clicked, it reveals other items/fields.
Here is the code snippet for the element:
<DIV class="section">
<H1 class="sectionHeader collapsed" onclick="toggleSection('ResolutionSection',this,'YES')">Resolution Section</H1>
<span style="width:100%;text-align: right;">
<A HREF="#top" class="toplink">
Go to top
</A>
The Selenium code attempts I have made so far are as follows:
driver.findElement(By.xpath("/html/body/form/div[2]/div[5]/div/table/tbody/tr/td/div/div[1]/div[4]/h1")).click();
driver.findElement(By.xpath("//div[@id='documentLayoutSection']/div[4]/h1")).click()
The errors encountered include:
cannot find element.
If anyone has any suggestions or solutions to this issue, please share them. Your help will be greatly appreciated.
Thank you