如何在 iMacros 中更改用户代理

How to change user agent in iMacros

我想使用 iMacros 插件从 firefox 捕获 iphone 屏幕截图。用户代理似乎没有触发。

window.resizeTo(720,1280);
var mobile_title_screen_screenshot = 'SET !USERAGENT "Mozilla/5.0 (iPhone; CPU iPhone OS 8_0_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12A366 Safari/600.1.4"'+"\n";
mobile_title_screen_screenshot += "SAVEAS TYPE=PNG FOLDER=mobile FILE=mobile-screenshot.png";
iimPlayCode(mobile_title_screen_screenshot)

我不太确定,不过你可以尝试触发 'Responsive Design View':

var mobile_title_screen_screenshot = 'SET !USERAGENT "Mozilla/5.0 (iPhone; CPU iPhone OS 8_0_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12A366 Safari/600.1.4"'+"\n";
mobile_title_screen_screenshot += 'EVENT TYPE=KEYPRESS SELECTOR=* CHAR="m" MODIFIERS="ctrl,shift"'+"\n";
mobile_title_screen_screenshot += "WAIT SECONDS=1"+"\n";
mobile_title_screen_screenshot += "SAVEAS TYPE=PNG FOLDER=mobile FILE=mobile-screenshot.png";
iimPlayCode(mobile_title_screen_screenshot);

在指定用户代理后添加 REFRESH 就可以了。