Issue
I want to use my custom Firefox profile and I'm getting a Deprecation Warning on
ProfilesIni myProfile = new ProfilesIni();
@SuppressWarnings. How do I fix this issue.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.internal.ProfilesIni;
import org.openqa.selenium.firefox.FirefoxProfile;
//System.setProperty("C:\\driver\\geckodriver.exe");
ProfilesIni myProfile = new ProfilesIni();
FirefoxProfile test = myProfile.getProfile("selenium 1");
WebDriver driver = new FirefoxDriver(test);
driver.manage().window().maximize();
driver.get("https://www.google.com");
Solution
Be aware there are two classes named ProfilesIni
org.openqa.selenium.firefox.ProfilesIni
org.openqa.selenium.firefox.internal.ProfilesIni
You can suppress the warning on class:
@SuppressWarnings("deprecation")
public class YourClass {
...
}
or on method:
@SuppressWarnings("deprecation")
public void foo() {
...
}
@SuppressWarnings("deprecation")
public WebDriver startGeckoDriver() {
WebDriver driver = ...;
return driver;
}
or on myProfile
:
@SuppressWarnings("deprecation")
ProfilesIni myProfile = new ProfilesIni();
In Eclipse you can add the annotation using the yellow warning icon:
Answered By - pburgr
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.