2015-01-20 2 views
1

이것은 다른 스크롤바 질문과 약간 다릅니다. 스크롤바가 존재하지 않는지 확인하는 요구 사항이 있습니다. 이 기능이 개발되기 전에 나는 페이지를 검사하고 xpath "// * [contains (@ id, 'scroller')] '를 발견했다. 이제 코드가 개발되었고 스크롤바가 없지만 xpath는 여전히 존재합니다. 난 그냥셀렌과 자바가있는 스크롤 막대 찾기

List<WebElement> a = driver.findElements(By.xpath("//*[contains(@id,'scroller')]) 

을 그리고 더 스크롤이 없다하더라도, 그 요소가 여전히 있기 때문에 s.size() == 0 주장 할 수

<div tabindex="-1" id="pt1:r1:0:pt1:t1::scroller" style="position: absolute; overflow: auto; z-index: 0; width: 456px; top: 32px; height: 119px; right: 0px;"> 
    <div style="width: 456px; height: 119px; visibility: hidden;"></div> 
</div> 

다음은 HTML 코드입니다. searchColumn가 더 이상 스크롤 막대가 없어야한다 테이블 (여전히보기) 테이블의 가장 오른쪽 열은 어디

나는 또한

((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", searchColumn); 

을 시도했다. 나는 이것이 스크롤 바 (scroll bar)가 없다고 주장 할 것이라고 생각했지만 그렇지 않았다.

스크롤 막대를 확인하는 방법에 대한 아이디어가 있습니까?

감사

답변

1

Scorllbar는 Webdriver의 findElement 방법을 사용하여 찾을 수있는 WebElement 없습니다.

개발자가 CSS 속성을 수정하여 스콜라 박스를 숨겼을 수 있습니다.

이 예제를 확인하십시오. W3Schools CSS 데모에서 가져온 것입니다. 그래서

div.scroll { 
 
    background-color: #00FFFF; 
 
    width: 100px; 
 
    height: 100px; 
 
    overflow: scroll; 
 
} 
 

 
div.hidden { 
 
    background-color: #00FF00; 
 
    width: 100px; 
 
    height: 100px; 
 
    overflow: hidden; 
 
}
<p>The overflow property specifies what to do if the content of an element exceeds the size of the element's box.</p> 
 

 
<p>overflow:scroll</p> 
 
<div class="scroll">You can use the overflow property when you want to have better control of the layout. The default value is visible.</div> 
 

 
<p>overflow:hidden</p> 
 
<div class="hidden">You can use the overflow property when you want to have better control of the layout. The default value is visible.</div>

는 테이블 요소에 액세스하고 스타일 속성을 확인하거나 자신이 수정 된 속성에 대한 개발자에게 문의하십시오.