I am trying to open Chrome and enter my url but I can see the browser opening but closes in seconds…
public class FormbayWeb extends FbWebExtReport {
public AppiumDriver driver;
public WebDriver webDriver;
@BeforeTest
public void winAppSetup() throws Exception
{
try
{
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("platformName", "Windows");
caps.setCapability("platformVersion", "10");
caps.setCapability("deviceName", "WindowsPC");
caps.setCapability("app", "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe");
URL url = new URL("http://127.0.0.1:4723/wd/hub");
driver = new AppiumDriver<WebElement>(url, caps);
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
catch(Exception ex)
{
System.out.println("Cause: "+ex.getCause());
System.out.println("Message: "+ex.getMessage());
ex.printStackTrace();
}
}
@Test
public void SampleTest(){
System.out.println("Browser is open");
}
@AfterTest
public void closeApp() throws InterruptedException, IOException
{
driver.quit();
System.out.println("Browser Closed");
}
}
FbOneTest
public class FbOneTest extends FormbayWeb{
@Test
public void OpenTrading() throws InterruptedException, IOException {
ExtentTest openTrading = extent.createTest("Trading is open", "Open Trading in Browser");
openTrading.log(Status.INFO, "Trading Test Started");
driver.get("www.google.com");
openTrading.log(Status.PASS, "Navigate to trading portal");
Thread.sleep(10000);
}
}
Error: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not proxy. Proxy error: Request failed with status code 501 (WARNING: The server did not provide any stacktrace information)