Protractor 将参数传递到browser.get-量角器 背景: @angular/cli 7.3.9 量角器5.4.0 karma 4.0.0 问题:

Protractor 将参数传递到browser.get-量角器 背景: @angular/cli 7.3.9 量角器5.4.0 karma 4.0.0 问题:,protractor,Protractor,量角器的浏览器方法get如何进行url参数查询 browser.get('${browser.baseUrl}?p=2')正在重定向到http://localhost:4200/&p=2而不是http://localhost:4200&p=2 当我按下browser.baseUrl的最后一个字符时,重定向的url为http://localhost:420/&p=2 有什么想法吗 编辑: 我试图通过添加baseUrl来编辑gragractor.conf.js,但我没有做任何更改…如果在配置文件中设

量角器
浏览器
方法
get
如何进行url参数查询

browser.get('${browser.baseUrl}?p=2')
正在重定向到
http://localhost:4200/&p=2
而不是
http://localhost:4200&p=2

当我按下
browser.baseUrl
的最后一个字符时,重定向的url为
http://localhost:420/&p=2

有什么想法吗

编辑:
我试图通过添加
baseUrl
来编辑
gragractor.conf.js
,但我没有做任何更改…

如果在配置文件中设置
baseUrl
,则无需在get方法中添加
browser.baseUrl
,您可以忽略它

例如,在配置中,您有:

exports.config = {
   // ...

   baseUrl: 'https://github.com/search',
}
在测试中,您只需添加如下查询参数:

it('should open the URL with the query parameter', async () => {
  await browser.get('?q=test'); // will open the 'https://github.com/search?q=test' page
});

感谢您的回复,我只是按照您显示的
baseUrl
的正确用法进行了操作。不幸的是,量角器仍然在查询参数(如
https://github.com/search/?q=test
。。。我仔细检查了
graphetor.conf.js
,在
baseUrl