Ruby 关于 selenium 中调用 JS 的一段代码

zerolin · July 31, 2013 · Last by zerolin replied at July 31, 2013 · 2986 hits

Selenium::WebDriver::Element.module_eval do def highlight e_id = self.attribute('id') puts "#{e_id} = e_id" js = <<JS document.getElementById("#{e_id}").style.border = "3px solid red" JS @bridge.executeScript(js) if e_id end end

代码如上,小弟没看明白的是 js = <<JS 和之后的 JS,这是什么语法,什么含义

You need to Sign in before reply, if you don't have an account, please Sign up first.