Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
iamsethi
Posts : 3
Join date : 2015-02-08

MouseHover and then click on Link Empty MouseHover and then click on Link

Sun Feb 08, 2015 5:30 pm
I am trying to write a piece of code which

1) Opens a URL
2) Mouse Hover
3) Click on a link which appears on Mouse Hover

Right now my code is completing the steps 1 and 2 but not the Step 3

Code:


package Selenium_Pack;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.testng.annotations.Test;

public class Day5 {
   
    public WebDriver driver;
   
    public Day5()
    {
        driver=new FirefoxDriver();
    }
   
    @Test
   
    public void Test() throws InterruptedException
    {
        driver.get("somelink");
        driver.manage().window().maximize();
       
        /*WebElement home = driver.findElement(By.xpath("//li//a[@href='#homeloan']"));
        home.click();
       
        WebElement homeloan = driver.findElement(By.xpath("//div[@class='hgreenicons1']"));
        homeloan.click();*/
       
        WebElement e = driver.findElement(By.xpath("//a[text()='Home Loan']"));
        Actions a= new Actions(driver);
        Thread.sleep(5000);
        a.moveToElement(e).perform();
        WebElement f = driver.findElement(By.xpath("//a[@class='parent' and @href='somelink'"));
        f.click();
       
       
       
       
       
       
       
       
    }

}


Any suggestions will be appreciated
avatar
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 38
Location : Denver, CO

MouseHover and then click on Link Empty Re: MouseHover and then click on Link

Fri Feb 13, 2015 12:17 am
Are you doing this in Selenium IDE?
Back to top
Permissions in this forum:
You cannot reply to topics in this forum