在硒webdriver,ruby中处理jquery定位器

问题描述

|| 我正在尝试使用ruby在Selenium Webdriver中使用jquery定位器。这是我的代码:
require \"selenium-webdriver\"

driver = Selenium::WebDriver.for(:remote,:desired_capabilities => :firefox)
driver.navigate.to(\"http://google.com\")

# input.lst is the search input text in google.com
selector = \"input.lst\"

# get element from the locator
element = driver.execute_script(\"return $(#{selector}).get(0);\")

# type \"google\" into the input text
element.send_keys \"google\"
我试过element = driver.find_element(),它工作正常,所以我认为也许有一种更通用的方法来完成所有的jQuery定位器。这就是为什么我尝试execute_script的原因。但是,似乎execute_script函数已损坏。我从sun.reflect,java.lang或org.openqa中收到很多错误... P / S:如果有人知道如何在webdriver中添加add_location_strategy,请告诉我有关:D。 Selenium rc如此出色,我找不到在webdriver中实现它的方法。     

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)