Author Topic: How to enable built-in VPN in OperaDriver?  (Read 121 times)

0 Members and 1 Guest are viewing this topic.

Offline natalejulie5.961

  • Newbie
  • *
  • Posts: 1
How to enable built-in VPN in OperaDriver?
« on: November 08, 2019, 12:15:32 PM »
The opera browser has a built-in VPN which allows you to hide your IP while browsing. My question is can the VPN be turned on while using OperaDriver with selenium in python?

Attempt and problem in detail:

I have this script that goes to a website to display my IP address.

from selenium import webdriver
from selenium.webdriver.opera.options import Options
from time import sleep
driver = webdriver.Opera(executable_path=r'/path/to/operadriver')
When I go to this site on the opera browser with VPN enabled, my IP is masked and some other IP address is shown. But my script opens up the browser to display my real IP address UPSers

I have searched almost all questions on OperaDriver on SO as well as on other sites. There seems to be absolutely no documentation or any other questions related to this anywhere.

The closest I got was this feature request on github. The OP says that he was able to make it work by using OperaOptions to load a custom profile. The code posted in the link is

OperaOptions operaOptions = new OperaOptions();
operaOptions.addArguments("user-data-dir", "~/Library/Application Support/com.operasoftware.Opera");
driver = new OperaDriver(operaOptions);
I tried to do this in python and nothing worked out. If it is of any concern I use Ubuntu 16.04, and OperaDriver is downloaded from the official github page. Python version is 3.6.7 and Opera version is 57.0.3098.116 for Ubuntu 16.04 LTS (x86_64; Unity).
« Last Edit: November 10, 2019, 11:54:20 AM by natalejulie5.961 »