2012年12月13日 星期四

Selenium-WebDriver API

 http://selenium.googlecode.com/svn/trunk/docs/api/rb/Selenium.html


例子提醒 :
driver.window_handle
driver.switch_to.window("<window_handle>")

driver = Selenium::WebDriver.for :firefox
driver.get "https://www.google.com"  
driver.save_screenshot("./screen.png")

profile = Selenium::WebDriver::Firefox::Profile.new
profile['network.http.phishy-userpass-length'] = 255
profile['network.automatic-ntlm-auth.trusteduris'] = 'http://example.com'
driver = Selenium::WebDriver.for :firefox, :profile => profile
driver.get "http:/username:password@example.com"

driver = Selenium::WebDriver.for :firefox, :profile => "default"
driver.get "http://example.com"

driver.execute_script("window.scrollBy(0,10000);")

沒有留言:

張貼留言