I need to setup proxy in my QAF test method. Below code is working fine without QAF. How to setup the same with QAF implementation?
// @Test
public void sampleTest() {
Proxy proxy = new Proxy();
proxy.setHttpProxy("localhost:8080");
proxy.setSslProxy("localhost:8080");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("proxy", proxy);
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
options.addArguments("--ignore-certificate-errors");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
@SuppressWarnings("deprecation")
ChromeDriver driver = new ChromeDriver(capabilities); // Here opening new window and able
to hit my localhost:8080
//i need to use following QAF methods which also needs to trigger my localhost
get("http://demo.rapidtestpro.com/login.php");
sendKeys("1234567", "//*[@id='accno']");
sendKeys("password123", "//*[@id=\"pass\"]");
System.out.println("Exit in sample test");
}
Also I tried to setup proxy in application.properties file like below
system.http.proxyHost=localhost
system.http.proxyPort=8080
Also tried in Testngconfig.xml file like below
<test name="java Test" enabled="true">
<parameter name="driver.name" value="chromeDriver"/>
<parameter name="system.http.proxyHost" value="localhost"/>
<parameter name="system.http.proxyPort" value="8080"/>
Nothing is triggered in localhost:8080.