プログラミング + アカデミック + 何か面白いこと

  1. Programming
  2. 0 view

[Selenium]Change User Agent with IDE

Pocket

Input following code as VerifyEval and “true” to expect value box.

var pref = Components.classes["@mozilla.org/preferences;1"]
           .getService(Components.interfaces.nsIPrefBranch);
           
var nsISupportsString = Components.interfaces.nsISupportsWString
    ||Components.interfaces.nsISupportsString;
    
var ua = (Components.classes["@mozilla.org/supports-wstring;1"])
    ? Components.classes['@mozilla.org/supports-wstring;1'].createInstance(nsISupportsString)
    : Components.classes['@mozilla.org/supports-string;1'].createInstance(nsISupportsString);
    
ua.data ="Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; Nexus S Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1";

pref.setComplexValue("general.useragent.override", nsISupportsString, ua);
true;
Pocket

Programming recent post

  1. Install sbt 1.0.0 and run sample template

  2. [Machine Learning]Created docker image includ…

  3. [Node.js]How to write batch script with Node.…

  4. [Play][Scala]Develop Request Driven Batch Usi…

  5. [OpenCV][Ruby]Auto check web page design corr…

関連記事

PAGE TOP