1
<tbody>
 <tr class="" style="height:65px;">
 <tr class="" style="height:65px;">
  <td class="dhx_matrix_scell" style="width:99px; height:64px;">Ashmita </td>
  <td>
   <div class="dhx_matrix_line" style="width:1181px; height:65px; position:relative;">
    <div class="dhx_marked_timespan dhx_matrix_now_time" style="height: 64px; left: 105px; width: 1px; top: 0px;"></div>
    <div class="dhx_marked_timespan gray_section" style="height: 64px; left: 588px; width: 591px; top: 0px;"></div>
    <div class="dhx_cal_event_line Booked" style="position:absolute; top:2px; height: 17px; left:99px; width:28px;" event_id="1374736442513">
    <table class="" cellspacing="0" cellpadding="0" style="width:1181px; height:65px;">
   </div>
  </td>
 </tr>
 <tr class="" style="height:65px;">
 <tr class="" style="height:65px;">
 <tr class="" style="height:65px;">
 <tr class="" style="height:65px;">
</tbody>

In the above code when I hover the mouse on the element <div class="dhx_cal_event_line Booked" style="position:absolute; top:2px; height: 17px; left:99px; width:28px;" event_id="1374736442513">, I get a tooltip tipsy which is generate dynamically; I can't catch it using firepath. I have tried the action class like

Actions action = new Actions(driver);
WebElement element = driver.findElement(By.xpath(".//*[@id='scheduler']/div[3]/table/tbody/tr[2]/td[2]/div/div[4]"));
action.moveToElement(element).build().perform();
System.out.println("the tool tip text is"+element.getText());
action.moveToElement(element).release().build().perform();

but i get null as element text.

Vince Bowdren
  • 8,326
  • 3
  • 31
  • 56
Lucan
  • 83
  • 1
  • 4
  • 11
  • Can you show us a screenshot of the tooltip? I'm guessing that it's not a small basic tooltip, but a larger html-enabled panel of some kind? – Vince Bowdren Aug 07 '13 at 13:37

1 Answers1

3

When you do this:

Actions action = new Actions(driver);
    WebElement element = driver.findElement(By.xpath(".//*[@id='scheduler']/div[3]/table/tbody/tr[2]/td[2]/div/div[4]"));
    action.moveToElement(element).build().perform();

Put a String source = driver.getPageSource(); and then save that source somewhere (or print it to console)

Take a look at the page source, to see what element has the tooltip text in it, and then you can write a selector for it.

Nathan Merrill
  • 7,648
  • 5
  • 37
  • 56
  • the path which i mentioned ".//*[@id='scheduler']/div[3]/table/tbody/tr[2]/td[2]/div/div[4]" is not valid if one more element presents in the table row and the event_id="1374736442513" is generated by dhtml-calendar it is dynamic one. now how to fetch the element ? – Lucan Jul 26 '13 at 06:48
  • Could you please post the HTML source (anything within the element with the scheduler ID) – Nathan Merrill Jul 26 '13 at 13:46