I am trying to hit the URL in UC browser however Unable to hit the URL , getting below exception:
Code-
public class AccountSetUpPage {
private BaseUtil base;
Utilities utility;
public static String environmentBeingTested = "";
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("MM/dd/yyyy HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
public static long startTime = 0;
public static String URLForExecution;
public AccountSetUpPage(WebDriver driver, BaseUtil base) {
PageFactory.initElements(driver, this);
this.base = base;
utility = new Utilities(driver);
}
@FindBy(how = How.XPATH, using = "(//a[contains(@class,'u01b-02__parent-link-href twtr-type--roman-16 twtr-scribe-clicks')])[1]")
private WebElement accountsetup;
public void navigatetogoglobalwithtwiterAccountSetUpPage() throws IOException
{
System.out.println("On navigate method for AccountSetUp Page ");
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("MM/dd/yyyy HH:mm:ss"); //in windows - yyyy/MM/dd
LocalDateTime now = LocalDateTime.now();
System.out.println(dtf.format(now));
long start = System.currentTimeMillis();
try {
File f = new File("Config.properties");
FileInputStream fis = new FileInputStream(f);
Properties p = new Properties();
p.load(fis);
String EnvForExecution = (String) p.get("locale");
environmentBeingTested = EnvForExecution;
switch (EnvForExecution) {
case "en_US":
URLForExecution = (String) p.get("Account");
break;
case "zh_CN":
URLForExecution = (String) p.get("Chinese_Account");
break;
default:
Assert.fail("Incorrect 'URLForExecution' mentioned in the Config.properties file");
}
System.out.println("########################## URL For Execution ########################");
System.out.println("##########################" + URLForExecution + "########################");
} catch (FileNotFoundException ex) {
Assert.fail("Config Properties file was not found");
}
startTime = System.currentTimeMillis();
System.out.println("We are navigating to the URL of AccountSetUp Web Page ");
base.Driver.navigate().to(URLForExecution);
System.out.println("We have navigated to the URL of AccountSetUp Web Page ");
long finish = System.currentTimeMillis();
long totalTime = finish - start;
System.out.println("Total Time for page load - " + totalTime);
try {
System.out.println("Writting the details to the Excel sheet ");
CommonExcelUtil.updateTheResponseIntoCSVFile(dtf.format(now), "AccountSetUp", Constants.Location,Constants.Platform, Constants.Browser,totalTime,Constants.Network, 7);
} catch (Exception e) {
System.out.println("Catch Block : Excel Utility for AccountSetUp Page ");
e.printStackTrace();
}
}
public void clickOntheAccountSetupLink()
{
accountsetup.click();
Set<String> windows = base.Driver.getWindowHandles();
for (String string : windows) {
base.Driver.switchTo().window(string);
}
}
public void ValidationOfAccountSetup()
{
try {
WebDriverWait wait = new WebDriverWait(base.Driver, 30);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//h1[contains(text(),'Twitter')]")));
if (base.Driver.findElement(By.xpath("//h1[contains(text(),'Twitter')]")).isDisplayed())
{
System.out.println("Validation Successful ");
} else
{
Assert.fail("Assert Failed : Account Set up page is not loaded ");
}
} catch (Exception e) {
System.out.println("Catch Block : Account set up ");
}
}
}
Exception
feature(com.Runner.TestRunner) Time elapsed: 84.002 sec <<< FAILURE!
cucumber.runtime.CucumberException:
org.openqa.selenium.UnsupportedCommandException: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
Build info: version: ‘3.14.0’, revision: ‘aacccce0’, time: ‘2018-08-02T20:19:58.91Z’
System info: host: ‘tw-mbp-monikaj’, ip: ‘fe80:0:0:0:18dd:43cf:2eca:9e5f%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.15.7’, java.version: ‘11.0.7.0.5’
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {appActivity: com.uc.browser.InnerUCMobile, appPackage: com.UCMobile.dev, autoAcceptAlerts: true, autoLaunch: true, automationName: UiAutomator2, chromedriverExecutable: /home/pbox/headspinio-pboxa…, chromedriverExecutableDir: /home/pbox/headspinio-pboxa…, chromedriverPorts: [1819, 1820, 1821, 1822, 1823], databaseEnabled: false, desired: {appActivity: com.uc.browser.InnerUCMobile, appPackage: com.UCMobile.dev, autoAcceptAlerts: true, autoLaunch: true, automationName: UiAutomator2, chromedriverExecutable: /home/pbox/headspinio-pboxa…, chromedriverExecutableDir: /home/pbox/headspinio-pboxa…, chromedriverPorts: [1819, 1820, 1821, 1822, 1823], deviceName: SM, noReset: true, platformName: android, platformVersion: 10, remoteAppsCacheLimit: 0, systemPort: 1824, udid: RC, uiautomator2ServerInstallTimeout: 40000}, deviceApiLevel: 29, deviceManufacturer: samsung, deviceModel: SM-A5160, deviceName: R5CN90PW8EL, deviceScreenDensity: 420, deviceScreenSize: 1080x2400, deviceUDID: R5CN90PW8EL, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, noReset: true, pixelRatio: 2.625, platform: LINUX, platformName: Android, platformVersion: 10, remoteAppsCacheLimit: 0, statBarHeight: 93, systemPort: 1824, takesScreenshot: true, udid: R5CN90PW8EL, uiautomator2ServerInstallTimeout: 40000, viewportRect: {height: 2093, left: 0, top: 93, width: 1080}, warnings: {}, webStorageEnabled: false}
Session ID: d0c3cf2e-8d7a-11eb-bd06-00e07c680cc0
Caused by: org.openqa.selenium.UnsupportedCommandException:
The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
Build info: version: ‘3.14.0’, revision: ‘aacccce0’, time: ‘2018-08-02T20:19:58.91Z’
System info: host: ‘tw-mbp-monikaj’, ip: ‘fe80:0:0:0:18dd:43cf:2eca:9e5f%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.15.7’, java.version: ‘11.0.7.0.5’
Driver info: io.appium.java_client.android.AndroidDriver