Selenium Webdriver-不支持Ruby命令

Selenium Webdriver-不支持Ruby命令,ruby,selenium,ide,webdriver,Ruby,Selenium,Ide,Webdriver,使用Selenium IDE,我导出了一个基本测试,该测试登录到一个帐户,将鼠标移到下拉列表上,并找到注销按钮。测试结束 我看到的问题是,当在ruby/test::unit/web驱动程序中导出测试时,我以前的命令waitForPopUp不受支持并返回 # ERROR: Caught exception [ERROR: Unsupported command [waitForPopUp | _self | 30000]] 我需要ruby翻译导航到鼠标上方,否则测试将超时并返回错误。另外,如果我

使用Selenium IDE,我导出了一个基本测试,该测试登录到一个帐户,将鼠标移到下拉列表上,并找到注销按钮。测试结束

我看到的问题是,当在ruby/test::unit/web驱动程序中导出测试时,我以前的命令waitForPopUp不受支持并返回

# ERROR: Caught exception [ERROR: Unsupported command [waitForPopUp | _self | 30000]]

我需要ruby翻译导航到鼠标上方,否则测试将超时并返回错误。另外,如果我再次遇到这个问题,请将我链接到ruby webdriver命令列表。

将使用Selenium IDE创建的测试用例导出到ruby等语言时,有些命令没有完全转换。waitForPopUp恰好是这些命令之一。相反,您需要在代码中找到无法转换的行,并编写支持的命令来执行相同的操作

您可能希望使用类似以下未经测试的代码!:

# This code defines the method
def wait_for_and_switch_to_new_popup(timeout = 30) # seconds
  Selenium::WebDriver::Wait.new(:timeout => timeout,:message => "Failed to find popup within #{timeout} seconds!").until do
    @driver.window_handle != @driver.window_handles.last
  end
  @driver.switch_to.window(@driver.window_handles.last)
end 

...

# This calls the method to wait for and switch to the new popup.
# Use this inside your code to tell the browser to switch to the new popup
wait_for_and_switch_to_new_popup

要了解有关DSL for Selenium WebDriver的Ruby绑定的更多信息,您可以在官方Wiki页面了解它们:

将使用Selenium IDE创建的测试用例导出到Ruby等语言时,有些命令没有完全转换。waitForPopUp恰好是这些命令之一。相反,您需要在代码中找到无法转换的行,并编写支持的命令来执行相同的操作

您可能希望使用类似以下未经测试的代码!:

# This code defines the method
def wait_for_and_switch_to_new_popup(timeout = 30) # seconds
  Selenium::WebDriver::Wait.new(:timeout => timeout,:message => "Failed to find popup within #{timeout} seconds!").until do
    @driver.window_handle != @driver.window_handles.last
  end
  @driver.switch_to.window(@driver.window_handles.last)
end 

...

# This calls the method to wait for and switch to the new popup.
# Use this inside your code to tell the browser to switch to the new popup
wait_for_and_switch_to_new_popup
要了解有关DSL for Selenium WebDriver的Ruby绑定的更多信息,您可以在官方Wiki页面了解它们: