Open ripalchauhan opened 6 years ago
You have to specify the Opera binary path via OperaOptions
. See https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/opera/OperaOptions.html#setBinary-java.lang.String- for more details.
If you are running on Windows, keep in mind #44 is still an issue, but the solution of directly passing the real Opera binary tends to work, see the comment by @wladzynski.
This worked for me. You have to specify the path of your opera binary file and add it in the options when you instanciate your WebDirver opbejct. See the code bellow.
.
.
.
static WebDriver webDriver;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
String path = "E:\\operadriver_win64\\operadriver_win64\\operadriver.exe";
OperaOptions options = new OperaOptions();
options.setBinary("C:\\Program Files\\Opera\\56.0.3051.43\\opera.exe");
System.setProperty("webdriver.opera.driver",path);
webDriver = new OperaDriver(options);
}
.
.
.
@doubleShot666 I followed your code, I am getting below error,
org.openqa.selenium.SessionNotCreatedException: session not created: No matching capabilities found Build info: version: '3.141.59', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '12.0.2' Driver info: driver.version: OperaDriver
doubleShot666 Thank you I tried to get it to work for 2 days, and your code worked!
Attempting to lunch Opera in windows 10 Using Selenium Web driver. Opera browser version 54, OperaDriver=2.36 or also tried latest one 2.37 but same exception coming.
import org.openqa.selenium.opera.OperaDriver;
public class OperaBrowser {
}