2011-04-29 7 views
1

의 방법을 잘라 내기? 대신 두툼한 긴의나는 다음과 같은 코드가 자바

win.<DomButton>find("//INPUT[@id='edit-submit']").select(); 

:

desktop.<BrowserApplication>find("//BrowserApplication").<BrowserWindow>find("//BrowserWindow").<DomButton>find("//INPUT[@id='edit-submit']").select(); 

이 응답 학급 전체를 붙여주세요 I는 다음과 같이 사용할 수 있도록 하시겠습니까?

+0

중복 : http://stackoverflow.com/questions/5835943/truncate-the-reference-to-class – mellamokb

답변

2
public class Search { 

    private Desktop desktop = new Desktop(); 
    BrowserWindow win; 

    @Before 
    public void baseState() { 
     BrowserBaseState baseState = new BrowserBaseState("silk4j.settings"); 
     win = baseState.execute(desktop).find("//BrowserWindow"); 
    } 

    @Test 
    public void searchNames() { 
     win.<DomButton>find("//INPUT[@id='edit-submit']").select(); 
    } 
} 
+0

코드가 작동하더라도, 그것은 더욱 절약 할 수 있습니다 승리 = baseState.execute (바탕 화면). find ("// BrowserWindow"); 앱을 완전히 삭제할 수 있습니다. 게시물을 수정 하시겠습니까? – Prostak

+0

@Prostak 맞습니다. 나는 나의 대답을 편집했다. –

관련 문제