Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/278.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 特性(@javascript)测试不需要';工作不好_Php_Selenium_Rhel_Behat - Fatal编程技术网

Php 特性(@javascript)测试不需要';工作不好

Php 特性(@javascript)测试不需要';工作不好,php,selenium,rhel,behat,Php,Selenium,Rhel,Behat,当我在浏览器的输入字段中键入关键字以查看结果时,我正在设置一个简单的检查。 当检查在javascript部分开始时,检查会在很长时间内完成,并出现错误 我使用的是:LinuxRedhat7 行为3.5.0 Selenium独立服务器3.141.59 貂皮1.6 # behat.yml default: extensions: Behat\MinkExtension: browser_name: chrome goutte: ~ javasc

当我在浏览器的输入字段中键入关键字以查看结果时,我正在设置一个简单的检查。 当检查在javascript部分开始时,检查会在很长时间内完成,并出现错误

我使用的是:LinuxRedhat7 行为3.5.0 Selenium独立服务器3.141.59 貂皮1.6

# behat.yml

default: 
  extensions: 
    Behat\MinkExtension: 
      browser_name: chrome
      goutte: ~
      javascript_session: selenium2
      selenium2: 
        wd_host: http://99.80.48.204:4444/wd/hub
        capabilities: { "browser": "chrome", "version": "*", 'chrome': {'switches':['--start-maximized']}}
      base_url: https://www.bing.com
  suites: 
    ui: 
      contexts: [FeatureContext, WebContext]

我希望快速检查,并且我的所有行都是绿色的,但目前它不起作用。

似乎页面未加载是且元素不在页面中

尝试:
1.使用等待方法等待页面加载
->等待(5000,“document.readyState=='complete'”

  • 如果需要,在php中使用循环等待元素出现,或者查看是否可以将
    wait
    与类似
    document.getElementById(“$field”)的条件一起使用!=空
  • 根据具体情况,如果从另一个页面导航,您可能只需要其中一个或两个页面,第二个页面可以包含在fill方法中。
    等待完成后,您可以填写该字段

    +将
    $javascript
    方法更改为

    document.getElementById(“$field”).value=“$value”

    最后,我修改了selenium和Behat的配置。现在,两者之间的联系正在发挥作用

    但是当我启动behat测试时-->bin/behat 代码运行速度比以前快,但仍有一个错误:

     Could not open connection: Error forwarding the new session cannot find : Capabilities {browser: chrome, browserName: chrome, browserVersion: 76.0.3809.12, ignoreZoomSetting: false, javascriptEnabled: true, name: Behat feature suite, platform: LINUX, selenium-version: 3.141.59} (Behat\Mink\Exception\DriverException)
    
    我正在搜索许多常见问题以获得回复,但没有机会。 请问有人能帮我吗


    谢谢

    经过几次尝试,我终于成功地在behat-selenium和我的webdriver之间建立了链接。 我最后一个错误是:

    无法打开连接:未知错误:找不到ChromeBarine

    但是,当我启动Behat命令时,Chromedriver正在整个进程中工作


    提前感谢

    您有什么错误?你用什么命令运行?我用bin/behat运行,当我用“grafikart”填写“sb_form_q”时,签入时。。。。。错误是:找不到id | name | label | value |占位符“sb_Form_q”的表单字段。(Behat\Mink\Exception\ElementNotFoundException)嗨,劳达,我尝试了你的方法,但结果是一样的。我改变了我的场景,以验证我的功能是否失败,但没有。检查需要8分钟以上才能得到一个糟糕的结果谢谢你对你的编辑表示赞赏,但我总是遇到同样的问题。当我运行我的行为时。没有@javascript标记的场景立即完成/变成绿色。在脚本开始检查第二个场景时,它会出现一个时间和错误。我检查了所有常见问题-论坛和其他找到一个解决方案,但没有成功。。。
    # bing.feature
    
    @insulated
    Feature: Bing
    
      Scenario: Homepage
        Given I am on the homepage
        Then  I should see "Bing"
        And I should see "Images"
        And I should see "Office Online"
      @javascript
      Scenario: Search
        Given I am on the homepage
        When I fill in "sb_form_q" with "grafikart" 
        And I wait for 1 seconds
        Then I should see "Grafikart.fr"
    
     Could not open connection: Error forwarding the new session cannot find : Capabilities {browser: chrome, browserName: chrome, browserVersion: 76.0.3809.12, ignoreZoomSetting: false, javascriptEnabled: true, name: Behat feature suite, platform: LINUX, selenium-version: 3.141.59} (Behat\Mink\Exception\DriverException)