Selenium - Doubt to locate element of a page inside the other

0

Could you help me with a Selenium question?

I'm automating access to a page, which has the following behavior: 1-When entering the home page, I click on a button called "Site Map" and a side menu is loaded 2-Through the xpath I try to locate one of the menu buttons, without success.

Investigating, I noticed that the menu is opened inside the home page, within a tag and as if it were a new page inside the other. As I do not know if I was clear, follow the example:

<!DOCTYPE html>
<html xmlns="...">
  <head>...<head>
  <body>
    <div id="id_1">
      <div id="id_2">
        <iframe id="menu">
         #document
           <!DOCTYPE html PUBLIC "...">
           <html>
             <head>...</head>
             <body>
               <div id="mapa_do_site">
                 <div id="botao">Botão do Menu</div>
               </div>
             </body>
           </html>
        </iframe>
      </div>
    </div>
 </body>
</html>

I used the xpath "// id [@ id=" button "]" to find the element that I need to click and Chrome successfully locates. However, the Selenium is not located. Because this is a new page inside another, I tried to put the new page inside a WebElememt and then look for the element within that WebElement, but without success. It looks like the search for an element just goes to #document. What's inside Selenium does not locate.

Do you know what I can do?

Thank you.

    
asked by anonymous 13.06.2018 / 14:56

0 answers