Update chrome.js

This commit is contained in:
Namhyeon Go 2022-01-09 13:53:40 +09:00 committed by GitHub
parent d834349da5
commit 624742edf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,7 +28,10 @@ var ChromeObject = function() {
"port": 1080
};
this.inPrivate = false;
// user agent
this.userAgent = null;
this.userAgents = [];
// dependencies
this.oAutoIt = null;
@ -175,6 +178,11 @@ var ChromeObject = function() {
return this;
};
this.addUserAgent = function(ua) {
this.userAgents.push(ua);
return this;
};
this.open = function(url) {
this.setProfile(this.profileName, this.installedDir);
@ -269,7 +277,12 @@ var ChromeObject = function() {
// set user data directory
cmd.push("--user-data-dir=\"" + this.userDataDir + "\"");
// set user agent
// choice user agent
if (this.userAgents.length > 0) {
this.setUserAgent(RAND.one(this.userAgents));
}
// set user agent
if (this.userAgent != null) {
cmd.push("--user-agent=\"" + this.userAgent + "\"");
}