0
我使用Selenium Webdriver,Chromedriver和Nokogiri。我写了一个脚本去Google.com和解析页面:如何用Selenium和Nokogiri将文本输入到文本框中?
require "selenium-webdriver"
require "nokogiri"
browser = Selenium::WebDriver.for :chrome
browser.get "https://google.com"
doc = Nokogiri::HTML.parse(browser.page_source)
现在,我怎么能输入的文字与我的Ruby脚本搜索栏?搜索栏的ID为#lst-ib
。
硒提供了大量的方法来找到一个页面的HTML部分了。通过使用Nokogiri,您可以找到相同的内容,但不能与找到的元素进行交互 – har07