Gulp 使用Microsoft Edge设置量角器

pes8fvy9  于 2022-12-08  发布在  Gulp
关注(0)|答案(7)|浏览(210)

我使用CucumberJs和Gulp来运行我的e2 e测试;然而,我需要在Microsoft Edge上运行它们。当我运行gulp protractor时,它成功地打开了Chrome和Firefox,因为它们都不需要任何像IEDriver.exeEdgeDriver.exe这样的驱动程序。
有人能给我指一篇文章或显示下面的步骤,如果它是简单的如何设置量角器与微软边缘?
我试图通过在多个浏览器上执行测试来实现并行性;我的配置如下所示:

exports.config = {
  framework: 'cucumber',
  shardTestFiles: true,
  maxInstances: 2,
  multiCapabilities: [
    {
       'browserName': 'MicrosoftEdge',
       'platform': 'windows',
      }
    },
    {
      'browserName': 'firefox',
      loggingPrefs: {
        driver: 'DEBUG',
        server: 'INFO',
        browser: 'ALL'
      }
    }],
    //more configs here
}

我实现了上面的配置,以并行运行量角器e2 e测试,使用这篇文章:http://blog.yodersolutions.com/run-protractor-tests-in-parallel/
此外,如果您不知道如何设置边缘,IE driver的一个也会很有帮助。

更新内容:

从此链接:在
使用Microsoft Edge启用Web驱动程序:
下载您选择的WebDriver语言绑定。当前支持C#和Java Selenium语言绑定。
我***没有使用Java或C#***,我只使用***Javascript(量角器)***;这是否意味着Javascript当前的语言绑定不适用于Edge浏览器?
换句话说,我们目前无法使用量角器(Javascript)自动化Edge浏览器。
任何帮助非常感谢,我会更新这篇文章,如果我发现任何有关设置量角器与边缘,一直在寻找周围的网络几个小时了。

ars1skjm

ars1skjm1#

经过一番挣扎,我让量角器在我的Windows 10系统上的Microsoft Edge上工作。

**注意:**我使用的是Jasmine 2框架而不是Cucumber,但我相信下面的步骤也适用于Cucumber。稍后我将尝试使用Cucumber,并在此处更新。

步骤如下:
1.获取您系统中使用的Microsoft EdgeHTML版本号。在我的示例中,它是15.15063。请在此处记下版本号。在本示例中,它是15063。
(Q.:如何获取Microsoft EdgeHTML版本号?
A.:边缘浏览器〉...〉设置〉关于此应用程序)
1.从https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/下载MicrosoftWebDriver.exe的正确版本
在我的例子中,我下载了Release 15063。如果你得到了错误的发行版,那么你很可能会遇到这样的错误:
“此版本的MicrosoftWebDriver.exe与已安装的Windows 10版本不兼容。”
1.将MicrosoftWebDriver.exe放在其他驱动程序所在的文件夹中,如下所示:

C:\Users\yourname\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\

1.调整你的conf.js文件,基本上,conf.js应该包含以下内容:

seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: // or multiCapabilities:
{
    'browserName': "MicrosoftEdge"
}

1.按如下方式启动webdriver-manager:

C:\your\path>webdriver-manager start --edge C:\Users\yourname\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\MicrosoftWebDriver.exe

1.您已设置好在Edge浏览器上运行量角器测试。
祝您好运!

0vvn1miw

0vvn1miw2#

1.在Windows中下载HTML版本〉= 18的MicrosoftEdge Webdriver,然后按照以下步骤操作
打开命令提示符,发出以下命令并等待操作完成

DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0

1.打开文件资源管理器并导航到C:\Windows\WinSxS,然后搜索MicrosoftWebDriver,它将显示两个结果,从amd 64_microsoft-webdriver-server-components 10.0.18362.1_none复制Web驱动程序并将其粘贴到
/c/Users/Administrator/AppData/Roaming/npm/node_modules/protractor/node_modules/webdriver-manager/selenium
(Note:使用git bash,很容易复制Webdriver)
1.在边缘浏览器的配置文件中,进行以下更改

seleniumArgs:['-Dwebdriver.edge.driver=C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\protractor\\node_modules\\webdriver-manager\\selenium\\MicrosoftWebDriver.exe'],

capabilities: {

    'browserName': 'MicrosoftEdge',
    'maxInstances': 1,
    'platformName': 'windows',
    'nativeEvents': false,
     shardTestFiles: true,
  },

1.打开命令提示符,导航到projectrepo并发出以下命令以启动边缘会话

webdriver-manager start --edge "C:\Users\Administrator\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\MicrosoftWebDriver.exe"
oipij1gg

oipij1gg3#

我在linux中使用Angular 9和Edge 89。以下配置对我有效

exports.config = {
  directConnect: true,
  chromeDriver: '/path/to/ms-edge/webdriver'
  capabilities: {
     browserName: 'chrome',
     chromeOptions: {
          binary: '/usr/bin/microsoft-edge'
     }
  },
},

官方的WebDriver可以找到here由于边缘使用 chrome 引擎,我们可以重用所有 chrome 配置,只是取代WebDriver和二进制路径。

dnph8jn4

dnph8jn44#

看起来量角器的人现在正在为量角器添加边缘支持。看看recently opened issue on GitHub

vom3gejh

vom3gejh5#

下载EdgeHTML Web驱动程序的正确版本(https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/),然后将conf.js设置为:

seleniumArgs: ['-Dwebdriver.edge.driver=C:\\Program Files (x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe'],

Capabilities: {
      'browserName': 'MicrosoftEdge',
      'maxInstances': 1,
      'platformName': 'windows',
      'nativeEvents': false,
    }
mi7gmzs6

mi7gmzs66#

Now Microsoft Edge is supported on Mac Operating System. So to setup in Mac follow below steps

  1. Download the MicrosoftEdge WebDriver from the following link according to version of the edge browser configured in Mac https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
  2. Unzip the folder and copy the Unix executable file to following path /usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/MicrosoftWebDriver
  3. In the config file add SeleniumArgs attribute and capabilities
    seleniumArgs : ['-Dwebdriver.edge.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/MicrosoftWebDriver'],
    capabilities: {
browserName: 'MicrosoftEdge',
platformName: 'Mac OS X',
browserVersion: '79.0.309.65',
maxInstances: 1,
shardTestFiles: true,
elementScrollBehavior: 1,
nativeEvents: false

},

  1. In order to start the web driver with Edge Session, use below command..
    java -jar -Dwebdriver.edge.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/MicrosoftWebDriver /Users//Desktop/Project/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar -port 4444
ioekq8ef

ioekq8ef7#

Edge无法与directconnect配合使用:false。请参考以下示例。

directConnect: false,
 multiCapabilities: [
    {​​​​​
      browserName: 'chrome',
      chromeOptions: {​​​​​
        args: ['--disable-popup-blocking'],
      }​​​​​
        }​​​​​,
{​​​​​
      browserName: 'firefox'
        }​​​​​,
{​​​​​
      browserName: 'MicrosoftEdge'
        }​​​​​
  ],
jvmArgs: [
    '-Dwebdriver.chrome.driver=./src/driver/chromedriver_87.0.4280.20.exe',
    `-Dwebdriver.edge.driver=${edgeDriver}`,
    '-Dwebdriver.gecko.driver=./src/driver/geckodriver-v0.28.0.exe'
  ],

如果使用mac,请在配置外使用以下代码

const edgeDriver =
  process.platform === 'darwin'
    ? './src/driver/edgedriver_mac64_87.0.664.47/msedgedriver'
    : './src/driver/msedgedriver.exe';

相关问题