2013-07-25 2 views
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> 

위의 코드에서 <div class="dhx_cal_event_line Booked" style="position:absolute; top:2px; height: 17px; left:99px; width:28px;" event_id="1374736442513"> 요소에 마우스를 올려 놓으면 동적으로 생성되는 툴팁 팁이 표시됩니다. 나는 화염을 사용하여 그것을 잡을 수 없다.동적으로 생성 된 툴팁 텍스트를 얻는 방법

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(); 

과 같은 액션 클래스를 시도했지만 요소 텍스트로 null이 나타납니다. 이 작업을 수행 할 때

+0

툴팁의 스크린 샷을 보여줄 수 있습니까? 나는 그것이 작은 기본적인 툴팁이 아니라, 어떤 종류의 더 큰 html-enabled 패널이라고 생각하고 있나? –

답변

2

는 :

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(); 

는을 무슨 요소를보고, 페이지 소스를 살펴 걸릴 String source = driver.getPageSource();를 넣고 어딘가 소스를 저장 (또는 콘솔에 인쇄)

을 툴팁 텍스트를 입력 한 다음 선택기를 작성할 수 있습니다.

+0

이제 도구 팁 텍스트를 찾았습니다. 감사합니다. – Lucan

+0

".//*[@ id = 'scheduler']/div [3]/table/tbody/tr [2]/td [ table 행에 요소가 하나 더 있고 event_id = "1374736442513"이 dhtml-calendar에 의해 생성되면 동적 요소 인 경우 [2]/div/div [4] "는 유효하지 않습니다. 이제 요소를 가져 오는 방법은? – Lucan

+0

HTML 소스 (스케줄러 ID를 사용하여 요소 내에있는 모든 것)를 게시 할 수 있습니까? –

관련 문제