我遇到的問題是我似乎無法找到如何獲取Bowser.text.include?尋找我在程序中早些時候給出的textinclude的價值。如何獲取Browser.text.include?搜索變量? (使用Watir和Ruby)
它似乎從字面上搜索#{textinclude},這顯然不存在。
這是我當前的代碼:
print('Enter your website: ')
website = gets()
puts("Testing #{website}")
print('What text do you want to find? ')
textinclude = gets()
puts("Finding #{textinclude}")
require 'watir'
browser = Watir::IE.new
browser.goto (website)
if browser.text.include? " #{textinclude} "
print("#{textinclude} present")
else
print("text not present")
end
感謝你的幫助。
感謝
我已經在網站www.google.com上測試了這一點,並搜索了「A faster」這個詞,它出現在我的谷歌主頁的右上角,順便說一下它對我有用。 – anonygoose
....真棒。非常感謝你。 :) – Benjamin