Protractor 无法直接将量角器与chromedriver和selenium服务器一起使用
最近我更新了我的Protractor 无法直接将量角器与chromedriver和selenium服务器一起使用,protractor,webdriver-manager,Protractor,Webdriver Manager,最近我更新了我的量角器,网络驱动程序管理器,chromedriver,selenium服务器 在此之后,我遇到了这个问题:以前我们在github中共享了一个量角器应用程序,其中包含chromedriver和selenium服务器。所以我项目中的其他人可以在下载这个git项目后直接使用它 量角器配置文件中没有seleniumAddress和directConnect。这意味着我们启动了本地驱动程序的测试 但是现在添加了update config.json文件来跟踪chromedriver和sele
量角器
,网络驱动程序管理器
,chromedriver
,selenium服务器
在此之后,我遇到了这个问题:以前我们在github中共享了一个量角器应用程序,其中包含chromedriver
和selenium服务器。所以我项目中的其他人可以在下载这个git项目后直接使用它
量角器配置文件中没有seleniumAddress
和directConnect
。这意味着我们启动了本地驱动程序的测试
但是现在添加了update config.json
文件来跟踪chromedriver和selenium服务器版本,其中的路径都是绝对路径。我们需要在下载后更改路径
那么,如果没有update config.json
文件,我们如何使用本地驱动程序呢?本文详细解释了量角器如何使用update config.json
。好消息是,如果愿意,您可以避免使用更新config.json
。我将为local
和directConnect
提供两个示例,因为它们相似:
不带update-config.json的本地
在lib/driverProviders/local.ts
中,如果在配置文件中提供指向和的路径,则可以避免使用update config.json
。如果量角器找不到它们,它将抛出一个浏览器错误
因此,您的配置文件看起来像:
exports.config = {
// launch locally when fields directConnect and seleniumAddress are not provided
chromeDriver: '/path/to/chromedriver',
seleniumServerJar: '/path/to/seleniumStandaloneServer.jar',
specs: [ '/some/test.js' ],
capabilities: {
browserName: 'chrome'
}
}
exports.config = {
directConnect: true,
chromeDriver: '/path/to/chromedriver',
specs: [ '/some/test.js' ],
capabilities: {
browserName: 'chrome'
}
}
不带update-config.json的directConnect
类似地,如果在配置中使用directConnect
时提供路径,则可以避免使用update config.json
。配置文件将类似于:
exports.config = {
// launch locally when fields directConnect and seleniumAddress are not provided
chromeDriver: '/path/to/chromedriver',
seleniumServerJar: '/path/to/seleniumStandaloneServer.jar',
specs: [ '/some/test.js' ],
capabilities: {
browserName: 'chrome'
}
}
exports.config = {
directConnect: true,
chromeDriver: '/path/to/chromedriver',
specs: [ '/some/test.js' ],
capabilities: {
browserName: 'chrome'
}
}
这里有一个关于量角器如何使用update config.json
的详细解释。好消息是,如果愿意,您可以避免使用更新config.json
。我将为local
和directConnect
提供两个示例,因为它们相似:
不带update-config.json的本地
在lib/driverProviders/local.ts
中,如果在配置文件中提供指向和的路径,则可以避免使用update config.json
。如果量角器找不到它们,它将抛出一个浏览器错误
因此,您的配置文件看起来像:
exports.config = {
// launch locally when fields directConnect and seleniumAddress are not provided
chromeDriver: '/path/to/chromedriver',
seleniumServerJar: '/path/to/seleniumStandaloneServer.jar',
specs: [ '/some/test.js' ],
capabilities: {
browserName: 'chrome'
}
}
exports.config = {
directConnect: true,
chromeDriver: '/path/to/chromedriver',
specs: [ '/some/test.js' ],
capabilities: {
browserName: 'chrome'
}
}
不带update-config.json的directConnect
类似地,如果在配置中使用directConnect
时提供路径,则可以避免使用update config.json
。配置文件将类似于:
exports.config = {
// launch locally when fields directConnect and seleniumAddress are not provided
chromeDriver: '/path/to/chromedriver',
seleniumServerJar: '/path/to/seleniumStandaloneServer.jar',
specs: [ '/some/test.js' ],
capabilities: {
browserName: 'chrome'
}
}
exports.config = {
directConnect: true,
chromeDriver: '/path/to/chromedriver',
specs: [ '/some/test.js' ],
capabilities: {
browserName: 'chrome'
}
}
好的,它起作用了。但是为什么要将完整的绝对路径添加到update-config.json,而不仅仅是版本?是的,它采用一个路径并验证该路径是否有效。版本不够,因为文件可能位于任何位置。如果它是一个可以解析的本地路径,那么您应该使用update config.json
这似乎与问题无关。。。然而,在我看来,你需要对你决定使用的工具的正反两方面做自己的研究。@cnishina:好的。我正在删除相同的。如果只听到专业的量角器,那就好了。好的,它能工作。但是为什么要将完整的绝对路径添加到update-config.json,而不仅仅是版本?是的,它采用一个路径并验证该路径是否有效。版本不够,因为文件可能位于任何位置。如果它是一个可以解析的本地路径,那么您应该使用update config.json
这似乎与问题无关。。。然而,在我看来,你需要对你决定使用的工具的正反两方面做自己的研究。@cnishina:好的。我正在删除相同的。如果只听到专业的量角器,那就好了。