0

これは私のコードです。ランダムなセキュリティの質問に答える必要がないように、保存された Cookie を使用する必要があります。私は何を間違っていますか?事前にアドバイスをありがとう。

pdate = `/Users/XXXX/lab2/cpb/CBTprevDate.pl`
download_directory = "/Users/XXXX/lab2/cpb"
puts download_directory
profile = Selenium::WebDriver::Chrome::Profile.new
profile['download.prompt_for_download'] = false
profile['download.default_directory'] = download_directory

client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 600 # seconds ?~@~S default is 60
b = Watir::Browser.new :chrome, :profile => profile, :http_client => client, :switches => %w[--user-data-dir=/Users/XXXX/lab2/cwm/Default]
4

1 に答える 1

0

watir-webdriver Cookies API を使用してみてください

b.goto 'http://yourwebsite.com'
b.cookies.clear
b.cookies.add 'SESSION', 'value'
于 2012-06-29T08:38:31.847 に答える