Finding XPath in Selenium

4

I'm breaking my head to find the XPath of a table . Could you help me?

The structure looks something like this:

 <div> 
  <div id="divMF">
   <iframe name="Principal>
     <frameset id="frmset">
       <frame name="corpo">
         <form name = "frmConsulta">
           <div id ="estrutura">
             <div id = "menos50">
               <div id = "idtable">

Could anyone help me?

    
asked by anonymous 07.02.2017 / 13:56

2 answers

5

If your idea is to get to <div id = "idtable"> , you can get there directly using just that:

//div[@id='idtable']
    
07.02.2017 / 17:05
1

Actually I needed to go to the frames before going to the div of the table. It looks like this:

driver.switchTo().frame(driver.findElement(By.tagName("iframe")));
    driver.switchTo().frame(driver.findElements(By.xpath("//frameset[@id='frmSet']/*")).get(2));
    WebElement table = driver.findElement(By.id("idTable"));

Thanks for the help!

    
08.02.2017 / 20:02