Moushover menu issue
Hi,
I have written some code for mousehover and get the link. But i am unable to solve this can u help me.
public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver","./driver/chromedriver81.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); driver.manage().deleteAllCookies(); driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS);
driver.get("https://www.spicejet.com/");
// create object for mouse hover
Actions action = new Actions(driver);
action.moveToElement(driver.findElement(By.xpath("//*[@id=\"highlight-addons\"]"))).build().perform();
Thread.sleep(3000);
driver.findElement(By.linkText("SpiceMax")).click();
//driver.quit();
}
Hi, Your code is Absolutely fine but inside XPath (By.xpath("//[@id='* highlight-addons']"))) values need to mention in Single quotes..
WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS);
driver.get("https://www.spicejet.com/");
// create object for mouse hover Actions action = new Actions(driver); action.moveToElement(driver.findElement(By.xpat h("//[@id='highlight-addons']"))*).build().perform(); Thread.sleep(3000); driver.findElement(By.linkText("SpiceMax")).click(); //driver.quit();
Thanks & Regards, Vinay Kumar Reddy
On Wed, May 20, 2020 at 3:25 PM likithasiteurl [email protected] wrote:
Hi,
I have written some code for mousehover and get the link. But i am unable to solve this can u help me.
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.chrome.driver","./driver/chromedriver81.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); driver.manage().deleteAllCookies(); driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS);
driver.get("https://www.spicejet.com/");
// create object for mouse hover Actions action = new Actions(driver); action.moveToElement(driver.findElement(By.xpath("//*[@id="highlight-addons"]"))).build().perform(); Thread.sleep(3000); driver.findElement(By.linkText("SpiceMax")).click(); //driver.quit();
}
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/naveenanimation20/SeleniumJavaCourse/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIFRDLAKMINQWUBGBNJ7HLLRSOSITANCNFSM4NFY5RSA .