Toggle navigation
Home
(current)
Selenium Training
Course Details
Free Videos
Support Forum
QTP UFT Training
Course Details
Free Videos
Support Forum
Appium Training
Course Details
Free Videos
Support Forum
Contact Us
(current)
All Courses
(current)
Login
(current)
Avail Discount
Name
Email
Phone Number
Tools
Selenium
QTP/UFT
Appium
Enroll Now
Home
Forum
Selenium Forum
Using Action - Element visible only on mouse over
Using Action - Element visible only on mouse over
M
Posted on 01/06/2016
Hi Ashish,
I have a scenario where the element is visible only when we mouse over. But when i tried its not clickable and getting error. Pls find my Selenium code
package MouseOverAndClick;
import org.openqa.selenium.By;
import org.testng.annotations.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
public class Example {
@Test
public void MouseOver(){
WebDriver driver=new FirefoxDriver();
driver.manage().window().maximize();
driver.get("http://play.dcsuperherogirls.com");
WebElement ApplePlay=driver.findElement(By.xpath("//*[@id='shg-sect-app']/div/div[2]/div/a[1]/img[2]"));
driver.findElement(By.xpath(".//*[@id='shg-sect-app']/div/div[2]/div/a[1]/img[2]"));
Actions action=new Actions(driver);
action.moveToElement(ApplePlay);
action.click(ApplePlay).perform();
driver.findElement(By.xpath("//*[@id='shg-sect-app']/div/div[2]/div/a[1]/img[2]")).click();
driver.quit();
}
}
Let me know whats wrong?
M
Replied on 02/06/2016
try to use explicit wait.