I'm automate a login process using Ruby mechanize. Because it's too complex to recreate the exactly process in mechanize, I choose to use existing cookies grabbed from browser document.cookie
. I want to know how can I use this string in Ruby mechanize. Thanks.
i dont think Mechanize runs Javascript, you'll have to use something like Selenium for that.
With Selenium, you can run arbitrary scripts. For example:
driver = Selenium::WebDriver.for :firefox
driver.get("http://some.url")
driver.execute_script("console.log('javascript')")
driver.close
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.