2

I am testing a website which has div containers one is like lightbox dialogbox containing subscription detail and other is at footer which behave like frame and unscrollable also contains subscription details.

How would I switch to these div tags and find elements on it.

I have tried this

  driver.switchTo().frame(driver.findElement(By.className("sign-up-container")));
  List<WebElement> subButtons = driver.findElements(By.className("btn-black"));
 for(WebElement btn: subButtons){
        System.out.println(btn.getText());
    }

and similarly for other div conatiner and its gives me error "Element is not a frame element". That error is right. Also if I comment the first line then I received empty string. How can I find the elements on these div tags? Please let me know if you need more detail. HTML for subscription button on both div is same.

 <input type="submit" class="btn btn-black" value="Sign Up"> 

and

<input type="submit" class="btn btn-black" value="subscribe"> 
Harry
  • 4,705
  • 17
  • 73
  • 101
  • 1
    So, are you trying to click on those `div`(s) which pops up lightbox and you want to interact with elements on that lighbox? – Saifur Mar 13 '15 at 23:52
  • 1
    You should use xpath to locate elements . http://stackoverflow.com/questions/16361535/webdriver-findelements-by-xpath – Martin Spamer Mar 14 '15 at 16:03

0 Answers0