-1

I have to Click on a dashboard which gets display after clicking on a menuitem .And both menuitem and dashboard are in different frames .

<html>
   <head>
   <frameset scrolling="no" framespacing="0" marginwidth="0" marginheight="0"     border="0" frameborder="0" rows="98,*">
         <frame scrolling="no" noresize="" marginwidth="0" marginheight="0" src="menu.jsp" name="menu">
          <script language="JavaScript">
          <script type="text/javascript" src="menu7_com.js" language="JavaScript">
              <div style="position: absolute; display: block; background-color: black; width: 1080px; height: 18px; z-index: 1101; top: 72px; left: 10px;">
              <div style="position: absolute; overflow: hidden; cursor: default; color: rgb(0, 0, 0); font-family: Arial;font-size: 9pt; font-weight: bold; font-style: normal; background-color: rgb(224, 224, 224); text-align:left; width: 110px; height: 16px; padding-left: 10px; padding-top: 2px; left: 0px; top: 0px;">
              <div style="position: absolute; overflow: hidden; cursor: default; color: rgb(0, 0, 0); font-family: Arial;           font-size: 9pt; font-weight: bold; font-style: normal; background-color: rgb(224, 224, 224); text-align:            left; width: 110px; height: 16px; padding-left: 10px; padding-top: 2px; left: 120px; top: 0px;">
    </div>      
        <frame scrolling="auto" style="scrollbar-base-color:blue;" noresize="" marginwidth="0" marginheight="0" src="Dashboard.do?action=DashBoard" name="display">
         <div style="position: absolute; overflow: hidden; cursor: default; color: rgb(0, 0, 0); font-family: Arial;            font-size: 9pt; font-weight: bold; font-style: normal; background-color: rgb(224, 224, 224); text-align:left; width: 110px; height: 16px; padding-left: 10px; padding-top: 2px; left: 120px; top: 0px;">
     </div>
   </frameset>
</html>
krishna beenavoina
  • 297
  • 1
  • 3
  • 9
  • 1
    Well, by default you cannot click on an invisible element. Could you share a link to the site and the code you have so far? Thanks. – alecxe Dec 04 '14 at 07:49
  • 1
    Please share more of the HTML code snippet starting from the menu item to the element you want to click. – Subh Dec 04 '14 at 07:58

2 Answers2

0

As you mentioned that it gets visible only after clicking on its 'Parent Div tag'. So you will have to first move the mouse to its parent Div element and then click on it's child. You can use Action class to move to the parent element and then click on its child. I have included the correct Xpath of Child Div tag in the same way you can get the Xpath of its parent Div tag.

Below is the example for the same.

        WebElement Parent_tag= driver.findElement(By.xpath("Xpath of Parent Div Tag"));
        WebElement Child_tag= driver.findElement(By.xpath("//div(contains(text(),'Create Hierarchy'))"));
        Actions action = new Actions(driver);
        action.moveToElement(Parent_tag).click(Child_tag).perform();
Rupesh Shinde
  • 1,933
  • 12
  • 22
0

Sorry , My question was slight wrong. Actually the div's are in different frames . But i found the solution .

driver.switchTo().frame("menu");
WebElement MenuOne = driver.findElement(By.xpath("html/body/div[1]/div[1]"));
MenuOne.click();
driver.switchTo().defaultContent();
driver.switchTo().frame("display");
WebElement Createborrower = driver.findElement(By.xpath("html/body/div[5]/div[3]"));
Createborrower.click();
krishna beenavoina
  • 297
  • 1
  • 3
  • 9