Custom useragent in nightwatch
问题 Is there a way to set a custom useragent for just one test in nightwatch? I want to test a page using both mobile and non-mobile useragents to ensure the proper experience is shown. I tried setting it as a cookie but it didn't work: browser .setCookie({ name : "User_Agent", value : "iphone", }) .url('...') // etc 回答1: Your test suite must be independent of the browser targeted. You should set the user agent directly in the NightWatch configuration json file : "test_settings" : { "default" : {