SeleniumHQ / selenium-google-code-issue-archive

Archive, please see main selenium repo
https://github.com/seleniumhq/selenium
346 stars 194 forks source link

Advanced user interaction become frozen with Internet Explorer 8 #3912

Closed lukeis closed 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 3912


What steps will reproduce the problem?

1. advanced user interactions

Selenium version: selenium server standalone 2.21.0.jar
OS: Win XP
Browser: Internet Explorer 
Browser version: 8

The Code is following

public void composeFunction(){

    driver.switchTo().frame("canvas_frame");

    // Internet Explorer 8
        WebElement inbox = driver.findElement(By.xpath(".//*     
                           [@class='n3']/div/div/div/div/div/img"));

    // Firefox
    //WebElement inbox = driver.findElement(By.xpath(".//* 
                             [@id=':b9']/div/img"));

    try {

        Thread.sleep(3000);

    } catch (InterruptedException e) {

        // TODO Auto-generated catch block

        e.printStackTrace();

    }

    Actions builder = new Actions(driver);  

    System.out.println(inbox.isDisplayed());

    Actions hoverOverRegistrar = 
                builder.moveToElement(inbox).clickAndHold();

    System.out.println(inbox.isDisplayed());

    Action temp = hoverOverRegistrar.build();

    temp.perform();

    System.out.println(inbox.isDisplayed());

    inbox.click();

    System.out.println(inbox.isDisplayed());
    }

After temp.perform() this thread is frozen.
I tried the following things with IE 8:

1. Set all security zones to same level
2. Set every security zone to the lowest possible security level (activated javacripting
as well java)

Had someone this problem before or is this an internal "feature" of selenium to be
kept for the future ?! 

Reported by AndreasKirsch82 on 2012-05-15 15:30:42

lukeis commented 8 years ago
To reproduce the issue, we need either a sample page (HTML + CSS + JS), or a link to
a public site where to apply your code to.

Reported by barancev on 2012-05-16 07:29:55

lukeis commented 8 years ago
Hi barancev,

first of all, thank you for the response!

The link where i applied the code is the following

http://www.gmail.com

The whole code i'm applying is as follows

package First;

import java.sql.Driver;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriverBackedSelenium;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.chrome.ChromeDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

import org.openqa.selenium.ie.InternetExplorerDriver;

import org.openqa.selenium.interactions.Actions;

import org.openqa.selenium.remote.DesiredCapabilities;

import org.openqa.selenium.support.ui.ExpectedCondition;

import org.openqa.selenium.support.ui.WebDriverWait;

import org.openqa.selenium.JavascriptExecutor;

import org.openqa.selenium.WebDriverCommandProcessor;

import org.openqa.selenium.WebDriverException;

import com.thoughtworks.selenium.Selenium;

import java.util.concurrent.TimeUnit;

public class Login_Firefox {

      // public WebDriver driver;

       public WebDriver driver;
       public Selenium seleniumDriver;

       public void start() {

           //driver = new FirefoxDriver();

           //Internet Explorer
           /**DesiredCapabilities capabilities = 
           DesiredCapabilities.internetExplorer();

  capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
true);
           driver = new InternetExplorerDriver(capabilities);*/
           driver = new InternetExplorerDriver();

           // driver.manage().timeouts().implicitlyWait(150, TimeUnit.SECONDS);

             //Chrome
//           driver = new ChromeDriver();
//           System.setProperty("webdriver.chrome.driver", "C:\\Users\\Student\\workspace\\SMBCloud\\chromedrive\\chromedriver.exe");

//           System.setProperty("webdriver.chrome.bin", "C:\\Benutzer\\Student\\Desktop\\chrome.exe");

             driver.get("http://www.gmail.com");
             seleniumDriver = new WebDriverBackedSelenium(driver, 
              "http://www.gmail.com");

             try {

                 Thread.sleep(6000);

             } catch (InterruptedException e) {

                 // TODO Auto-generated catch block

                 e.printStackTrace();

             }

             //WebElement anmelden = driver.findElement(By.xpath("//*[@id='Email']"));
             //anmelden.click();

             WebElement bentz = driver.findElement(By.xpath(".//*[@id='Email']"));
             bentz.sendKeys("AndreasKirsch82@gmail.com");

             WebElement pass = driver.findElement(By.xpath(".//*[@id='Passwd']"));
             pass.clear();
             pass.sendKeys("XXX");

             WebElement acc = driver.findElement(By.xpath(".//*[@id='signIn']"));
             acc.click();

             //ende anmeldung

             try {

                 Thread.sleep(6000);

             } catch (InterruptedException e) {

                 // TODO Auto-generated catch block

                 e.printStackTrace();

             }

             //neue seite

             //driver.switchTo().defaultContent();

             /**
             driver.switchTo().frame("canvas_frame");
             ///html/body/div/div[2]/div/div[2]/div/div/div/div[2]/div/div/div/div/div
             //WebElement dropdown = driver.findElement(By.xpath(".//*[@class='account']/div[@class='fleft']"));
             //WebElement dropdown = driver.findElement(By.xpath(".//*[@id='Compose']"));
             WebElement dropdown = driver.findElement(By.xpath("//div[contains(text(),
'COMPOSE')]"));
             try {

                 Thread.sleep(3000);

             } catch (InterruptedException e) {

                 // TODO Auto-generated catch block

                 e.printStackTrace();

             }
             dropdown.click();
             */

             /*WebElement abmelden = driver.findElement(By.xpath(".//*[@id='logout']"));

             Actions builder = new Actions(driver);    
             builder.moveToElement(dropdown).perform();

             abmelden.click();

             */

             //driver.close();
 }

       public WebDriver getWebDriver(){

           return driver;
       }

       public Selenium getSeleniumDriver(){

           return seleniumDriver;
       }

       public static void main(String[] args) {

             Login_Firefox start = new Login_Firefox();

             start.start();

       }

}

package First;

import java.sql.Driver;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriverBackedSelenium;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.chrome.ChromeDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

import org.openqa.selenium.ie.InternetExplorerDriver;

import org.openqa.selenium.interactions.Actions;

import org.openqa.selenium.interactions.Action;

import org.openqa.selenium.remote.DesiredCapabilities;

import org.openqa.selenium.support.ui.ExpectedCondition;

import org.openqa.selenium.support.ui.WebDriverWait;

import org.openqa.selenium.JavascriptExecutor;

import org.openqa.selenium.WebDriverCommandProcessor;

import org.openqa.selenium.WebDriverException;

import com.thoughtworks.selenium.Selenium;

public class Compose {

    public Login_Firefox login;
    public WebDriver driver;
    public Selenium seleniumDriver;

    public Compose(){

        login = new Login_Firefox();
        login.start();

        driver = login.getWebDriver();
        seleniumDriver = login.getSeleniumDriver();
    }

    public void composeFunction(){

    driver.switchTo().frame("canvas_frame");

    // Internet Explorer 8
    WebElement inbox = driver.findElement(By.xpath(".//*[@class='n3']/div/div/div/div/div/img"));

    // Firefox
    //WebElement inbox = driver.findElement(By.xpath(".//*[@id=':b9']/div/img"));

    //seleniumDriver.mouseOver(".//*[@class='n3']/div/div/div/div/div/img");

    try {

        Thread.sleep(3000);

    } catch (InterruptedException e) {

        // TODO Auto-generated catch block

        e.printStackTrace();

    }

    Actions builder = new Actions(driver); 

    System.out.println(inbox.isDisplayed());

    Actions hoverOverRegistrar = builder.moveToElement(inbox).clickAndHold();

    System.out.println(inbox.isDisplayed());

    Action temp = hoverOverRegistrar.build();

    temp.perform();

    System.out.println(inbox.isDisplayed());

    inbox.click();

    System.out.println(inbox.isDisplayed());
    }

    public static void main(String[] args) {

          Compose compose = new Compose();
          compose.composeFunction();

    }
}

So what i'm trying to do, is to login to googlemail-service (this works fine), and
the to hit the dropdown-button of Inbox (this doesn't work, since the thread becomes
frozen).

Before the usage of advanced user interaction, I've used javascript to implement "mouseover"
and "mouseclick", but i got always a script error.

Anyway the problem is now, that at 

temp.perform(); (see public void composeFunction())

the thread becomes frozen. Yesterday I've tried a lot of things, now i gonna reinstall
Internet Explorer and try again everything i've tried before.

Reported by AndreasKirsch@gmx.net on 2012-05-16 08:09:03

lukeis commented 8 years ago
If you want to click a small traingle on the right of "Inbox", here is the code:

WebElement inbox = driver.findElement(By.xpath(".//*[@class='n3']/div/div/div/div/div"));
WebElement inboxImg = driver.findElement(By.xpath(".//*[@class='n3']/div/div/div/div/div/img"));
new Actions(driver).moveToElement(inbox).moveToElement(inboxImg).click().perform();

Checked to work in IE9. Please check if it work for you.

Reported by barancev on 2012-05-16 08:25:55

lukeis commented 8 years ago
Good evening barancev,

first of all - your solution is working and solved my problem!!!

So I see, that i did it wrong and not selenium. The programming with Advanced User
Interaction is kind of tricky, but now I like selenium very much, since the Advanced
User Interaction is implemented very tidy  - but one (at least me) have to understand
first how to use this Tool.

Thank you very much barancev!
I will visit this forum in the future more often - I hope not with new problems, but
helping other guys.

Reported by AndreasKirsch@gmx.net on 2012-05-16 18:28:47

lukeis commented 8 years ago

Reported by barancev on 2012-05-16 18:57:50

lukeis commented 8 years ago

Reported by luke.semerau on 2015-09-17 18:15:23