Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
181
rated 0 times [  186] [ 5]  / answers: 1 / hits: 17104  / 13 Years ago, tue, september 27, 2011, 12:00:00

Is there a known solution to perform Eval (Javascript execution) in Webdriver, Ruby bindings?



The equivalent of the following example in Java.



 WebElement element = driver.findElement(By.id( foo ));
String name = (String) ((JavascriptExecutor) driver).executeScript(
return arguments[0].tagName , element)

More From » ruby

 Answers
184

The equivalent Ruby would be:



 name = driver.execute_script(return arguments[0].tagName , element)


(to get the tag name you could also just call element.tag_name)


[#89899] Monday, September 26, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
zaynerogerb

Total Points: 454
Total Questions: 109
Total Answers: 97

Location: Comoros
Member since Tue, Mar 14, 2023
1 Year ago
zaynerogerb questions
;