문제

몇 단계를 다시 탐색 해야하는 자동 테스트를 만들고 있습니다. Watir에서 그렇게 할 수 있습니까 ??

결과리스트 페이지로 탐색하고 있으며 (Windows 브라우저) 뒤로 클릭하여 테스트 시작으로 돌아가고 싶습니다. Thnx

도움이 되었습니까?

해결책

Watir :: IE 객체가있는 경우 #Back은 원하는 작업을 수행하는 메소드입니다.

http://wtr.rubyforge.org/rdoc/classes/watir/ie.html#m000245

어떤 오류 가보고 있습니까?

다른 팁

이것이 내가 시도한 방법입니다.

@site.ie.wait_until(1200) { |ie| ie.contains_text(/Sort after/) }
  2.times{@site.ie.back
}

Watir의 #Back Call을 사용하는 코드 예제 ( 표준 위키 백과 예제):

 require 'watir'
 test_site = 'http://www.google.com/'
 ie = Watir::IE.new
 ie.goto(test_site)
 ie.text_field(:name, "q").set("pickaxe")
 ie.button(:name, "btnG").click

 if ie.text.include?("Programming Ruby")  
   puts "Test Passed. Found the test string: 'Programming Ruby'."
 else
   puts "Test Failed! Could not find: 'Programming Ruby'." 
 end

 ie.back

 if ie.url == test_site
   puts "Test Passed. Returned to search page."
 else
   puts "Test Failed! URL is now #{ie.url}."
 end

 ie.close

당신은 확실히 실행할 수 있습니다 자바 스크립트 Watir 사용.

@browser.execute_script('window.history.back();')
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top