首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未初始化常量Applitools::Utils::EyesSeleniumUtils::Appium (NameError)

未初始化常量Applitools::Utils::EyesSeleniumUtils::Appium (NameError)
EN

Stack Overflow用户
提问于 2018-01-11 09:19:29
回答 1查看 364关注 0票数 0

我在运行红宝石应用程序脚本时出错了-

Erro -“`mobile_device?”:未初始化的常量Applitools::Utils::EyesSeleniumUtils::Appium (NameError)

下面是我的课-

代码语言:javascript
复制
require 'eyes_selenium'
require 'selenium-webdriver'
# Initialize the eyes SDK and set your private API key.
eyes = Applitools::Selenium::Eyes.new
eyes.api_key = 'YOUR_API_KEY'
# Open a Chrome Browser.
driver = Selenium::WebDriver.for :chrome
begin
  # Start the test and set the browser's viewport size to 800x600.
  eyes.test(app_name: 'Hello World!', test_name: 'My first Selenium Ruby test!',
            viewport_size: {width:800, height:600}, driver: driver) do
    # Navigate the browser to the "hello world!" web-site.
    driver.get 'https://applitools.com/helloworld'
    # Visual checkpoint #1.
    eyes.check_window 'Hello!'
    # Click the "Click me!".
    driver.find_element(:tag_name => 'button').click
    # Visual checkpoint #2.
    eyes.check_window 'Click!'
  end
ensure
  # Close the browser.
  driver.quit

  # If the test was aborted before eyes.close was called, ends the test as aborted.`
EN

回答 1

Stack Overflow用户

发布于 2018-02-07 15:59:31

似乎您已经设置了一个变量$driver。它应该被Appium用于其测试。

作为一个快速修复,尝试为您的测试显式地将$driver设置为0(例如-在脚本的开头),如下所示:

$driver = nil

注意,变量前面的“$”号很重要,$driverdriver不一样

此外,没有必要要求“selenium-webdriver”,因为eyes_selenium将自动将其作为依赖项来使用。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48203465

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档