title: selenium webdriver - detection of the javascript dialogue
body: <p>Please verify my code for the following URL with credentials as </p>
  
  <p>URL: <a href="http://ec2-54-226-18-214.compute-1.amazonaws.com/w/user.html?action=login" rel="nofollow">http://ec2-54-226-18-214.compute-1.amazonaws.com/w/user.html?action=login</a></p>
  
  <p>username: root</p>
  
  <p>password: 12345678</p>
  
  <p>code:</p>
  
  <pre><code>d1.switchTo().window("modalbox");
  
  WebElement select = d1.findElement(By.id("getSelectedCountry"));
  List&lt;WebElement&gt; options = select.findElements(By.tagName("Qatar"));
  
  for (WebElement option : options) {
      if("Qatar".equals(option.getText().trim()))
      option.click();   
  }
  </code></pre>