0
votes

This is popup in my project, I am facing problem with click on"I'm ready to return to the registration home page"link of it. I'm locating by id

driver.findElement(By.cssSelector("a[id*='ProgramWizardBase_ctl00_HomePageHyperLink']")).click();

It throws error "Element is not currently visible and so may not be interacted with element"][1] [1]: http://i.stack.imgur.com/sbjJb.png

3
is you element really visible? if it's not, maybe you should try something like stackoverflow.com/a/35649658/1033737 - thefabbulus
you can check it by isVisible - Fazz

3 Answers

0
votes
driver.findElement(By.xpath("//a[@id='ProgramWizardBase_ctl00_HomePageHyperLink']")).click());
0
votes

First you need to move to alert like:

 driver.switchTo().alert();

and then try to perform action (assuming you are finding element correctly):

driver.findElement(By.cssSelector("a[id*='ProgramWizardBase_ctl00_HomePageHyperLink']")).click();
0
votes

Thanks All, Actually the element was invisible so i tried like this -

element = driver.findElement(By.cssSelector("a[id*='ProgramWizardBase_ctl00_HomePageHyperL‌​ink']"));

JavascriptExecutor js = (JavascriptExecutor)driver;

js.executeScript("arguments[0].click();", element); 

and its working..