《兔基-多通证的自治贴吧》上有1条评论

  1. require “selenium-webdriver”

    Selenium::WebDriver.logger.level = :debug
    options = Selenium::WebDriver::Chrome::Options.new
    options.add_argument(‘–ignore-certificate-errors’)
    options.add_argument(‘–ignore_-popup-blocking’)

    driver = Selenium::WebDriver.for :chrome, options: options

    driver.navigate.to ‘http://www.baidu.com’

    usr = driver.find_element(id: ‘usr’)
    usr.send_keys ‘062’

    pwd = driver.find_element(id: ‘pwd’)
    pwd.send_keys ‘583963’

    btn = driver.find_element(class: ‘ljsw’)
    btn.click

    sleep 5
    puts driver.title
    puts driver.current_url
    driver.quit

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.