Issue
I am working on selenium-Cucumber-Gradle project I see that when I execute my UI Automation scripts with chrome browser it just open the browser and even I could the see the url is shown up in the browser address bar but within 2 seconds it exits with a exception as shown below. Any advise here would be greatly appreciated. I am using the latest chrome browser and chrome driver
Output Results =============
Given User navigates to the Rlbs website # RLbys_CardPage_Ui_Step_Test.navigates_to_the_RLby_s_website()
org.openqa.selenium.WebDriverException: unknown error: net::ERR_NAME_NOT_RESOLVED
(Session info: chrome=85.0.4183.83)
Build info: version: '4.0.0-alpha-4', revision: 'c2d955b49e'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 85.0.4183.83, chrome: {chromedriverVersion: 85.0.4183.87 (cd6713ebf92fa..., userDataDir: C:\Users\xxx~1\AppData\L...}, goog:chromeOption
s: {debuggerAddress: localhost:61816}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileIntera
ctability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true}
Session ID: e88071b72a89d636e000150881ccb44a
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:196)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:129)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:53)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:161)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:582)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:282)
at com.pros.HALbrands.test.stepdefinition.HALCardPage_Ui_Step_Test.user_navigates_to_the_HALRLby_s_website(HALRLbyCardPage_Ui_Step_Test.java:40)
at ?.User navigates to the HALRLby website(file:src/test/resources/featurefile/HALRLbyCardPage_Ui.feature:5)
May i know what might be issue for which is exception is thrown.
Please find the code snippet below:
Feature File Code
Feature: Google Search Functionality
Scenario: Validate google search functionality Given User navigates to the google website When User enters text as Cards in search text field
Step Defenition
public class Test1
{
@Given("User navigates to the google website")
public void user_navigates_to_the_Google_s_website() {
driver.get("https://www.google.com/");
}
}
------------------------------Invoking Browser Below --------------------------
public WebDriver standAloneStepUp(BrowserType bType) throws Exception {
WebDriver driver;
try {
oLog.info(bType);
switch (bType) {
case CHROME:
//ChromeBrowser chrome = ChromeBrowser.class.newInstance();
//WebDriverManager.chromedriver().setup();
System. setProperty("webdriver.chrome.driver", System.getProperty("user.dir")+"\\src\\main\\resources\\driver\\chromedriver.exe");
driver = new ChromeDriver();
return driver;
case FIREFOX:
// FirefoxBrowser firefox = FirefoxBrowser.class.newInstance();
// WebDriverManager.firefoxdriver().setup();
System. setProperty("webdriver.gecko.driver", System.getProperty("user.dir")+"\\src\\main\\resources\\driver\\geckodriver.exe");
driver = new FirefoxDriver();
//driver = new FirefoxDriver(firefox.getFirefoxOptions());
return driver;
default:
throw new NoSutiableDriverFoundException(" Driver Not Found : " + ObjectRepo.reader.getBrowser());
}
} catch (Exception e) {
oLog.equals(e);
throw e;
}
}
Solution
I figure it out what was the issue. Actually this happens when you are accessing the site which is not yet open to public. So got it resolved in two steps :
- First I connected to client VPN
- Though connected to client VPN but still I was getting this same issue so went and added few lines related to clinet url along with ip address in host file
Path of host file : C:\Windows\System32\drivers\etc\host
10.104.0.38 ida-oa.dev.dp-prv.halproducts.eastus.cloudapp.azure.com
10.104.0.38 order-inte-service-dev.dev.dp-prv.halproducts.astus.cloudapp.azure.com
<ip adress > <client env url >
Answered By - Balaji Singh .Y
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.