I am working on assignment where there are no locator available to locate elements. I am trying to perform Subtraction functionality of a Online Calculator.
URL: https://www.online-calculator.com/full-screen-calculator/
I have tried below code so far:
WebDriver driver;
System.setProperty("webdriver.chrome.driver", "F:\\Al_Driver\\chromedriver.exe");
driver = new ChromeDriver();
driver.get("https://www.online-calculator.com/full-screen-calculator/");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
Robot r = new Robot();
r.keyPress(KeyEvent.VK_8);
r.keyRelease(KeyEvent.VK_8);
r.keyPress(KeyEvent.VK_SUBTRACT);
r.keyRelease(KeyEvent.VK_SUBTRACT);
r.keyPress(KeyEvent.VK_5);
r.keyRelease(KeyEvent.VK_5);
r.keyPress(KeyEvent.VK_EQUALS);
r.keyRelease(KeyEvent.VK_EQUALS);
driver.close();
Only thing in the above code is that i am unable to perform assertion using selenium. Also i am hardcoding values in the script. Is there any way to find the elements of the given URL or any other way to perform the same?? Any help will be appreciated.Thanks in Advance