RE: Action class click().build.perform(); does not load a new page
I have used the website http://store.demoqa.com/ to practice automation using Selenium Webdriver – Java.
I am automating the following scenario
1. Hover on Product category menu
2. Click on Accessories sub menu – The Accessories Page is loaded
3. Check if the title of the Accescories page matches with the expected title
I used Action class and was able to go upto clicking of the Accessories sub menu.
However,when running the test .I can see the clicking being done by the driver but it does not load the Accessories Page at all and hence the test fails due to TimeOut Exception.
I have tried using click(), clickAndHold() as well as doubleclick() but none works.
Code is given below
WebDriverWait myWaitvar = new WebDriverWait (driver, 10);
Actions action = new Actions (driver);
WebElement mainMenu = driver.findElement(By.id(“menu-item-33”));
WebElement subMenu = driver.findElement(By.id(“menu-item-34”));
//This is to wait till this element is visible on the page
What is the issue with the code above and how can the click load the Accessories page?
Yes I tried having both the webelements on the same line and its working perfectly fine. Also I realised that the xpath that I was using was of a div and not the link,hence replaced with linkText. Now its working
Thank you so much for your responses!