Getting following error when selenide was updated to 3.7 #366

Closed
anilreddy opened this Issue Aug 4, 2016 · 13 comments

Projects

None yet

4 participants

@anilreddy
Contributor
anilreddy commented Aug 4, 2016 edited

Hi @asolntsev,

While running our test suites by upgrading the selenide version to 3.7. I am facing following exception. It is working fine in 3.5 version.

org.openqa.selenium.TimeoutException: Timed out after 120 seconds waiting for alert to be present
Build info: version: '2.53.1', revision: 'a36b8b1cd5757287168e54b817830adce9b0158d', time: '2016-06-30 19:26:09'
System info: host: 'KMI-DSERT956', ip: '193.225.171.68', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_65'
Driver info: driver.version: unknown
selenide.url: https://xdev.basic.com/facility/secure/jas/facilityVal?timestamp=866939626117330
selenide.baseUrl: https://xdev.basic.com/facility/secure/jas/facilityVal
    at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:292)
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:261)
    at com.codeborne.selenide.SelenideTargetLocator.alert(SelenideTargetLocator.java:57)
    at com.codeborne.selenide.impl.Navigator.navigateToAbsoluteUrl(Navigator.java:72)
    at com.codeborne.selenide.impl.Navigator.open(Navigator.java:33)
    at com.codeborne.selenide.Selenide.open(Selenide.java:79)
    at com.codeborne.selenide.Selenide.open(Selenide.java:148)
    at com.codeborne.selenide.Selenide.open(Selenide.java:129)
    at com.basic.facility.regression.tests.LoginTest.setUpConfig(LoginTest.java:155)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
@asolntsev
Member

@anilreddy I see that this code hasn't been modified since Selenide 3.4
Can you provide some test that would reproduce the problem?

@simple-elf
Contributor

I guess this is problem with basic domen authorization. When it's url like http://user:pass@url.com. But for IE it waiting for alert. But then I worked with url like this on pure selenium, a was able to login without handling alert. Just adding "login:pass@" to url was enough.

@vinogradoff vinogradoff closed this Aug 5, 2016
@vinogradoff vinogradoff reopened this Aug 5, 2016
@simple-elf
Contributor

Please give us your IE version and confirm, that you have basic auth in your app.

@anilreddy
Contributor

It is working fine in all the browsers except IE and app doesn't have basic auth. I cannot give you example using our app because it will not work outside.
IE Version: InternetExplorerDriver server (32-bit) 2.53.1.0.

@simple-elf
Contributor
simple-elf commented Aug 8, 2016 edited

I asked for IE version, not IE driver. Guess it's IE8 =)
Please give us just code, there you call "open" method.
at com.basic.facility.regression.tests.LoginTest.setUpConfig(LoginTest.java:155)

@simple-elf
Contributor

Maybe it's related to #320

@simple-elf
Contributor

@anilreddy Please confirm, that you have IE8

@anilreddy
Contributor

@simple-elf sorry we are using IE 11 and this is my code

// LoginPage 

    env = utils.getPropValues(ENV);
    baseUrl = "https://" + env + ".basic.com/facility/secure/jas/facilityVal";
    timeout = 120000;
    pollingInterval = 3500;
    fastSetValue = true;
    browser = utils.getPropValues(BROWSER);

        if (StringUtils.isNotEmpty(browser) && browser != null) {
            if (isHeadless()) {
                File phantomjs = Phanbedder.unpack();
                DesiredCapabilities capabilities = new DesiredCapabilities();
                Logger.getLogger(PhantomJSDriverService.class.getName()).setLevel(Level.OFF);
                capabilities.setJavascriptEnabled(true);
                capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,
                        phantomjs.getAbsolutePath());
                capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS,
                        new String[] { "--ignore-ssl-errors=true", "--ssl-protocol=any", "--webdriver-loglevel=NONE" });
                driver = new PhantomJSDriver(capabilities);
            } else if (isIE()) {
                System.setProperty("webdriver.ie.driver", "src/main/resources/IEDriverServer.exe");
                driver = new InternetExplorerDriver();
            } else if (isChrome()) {
                System.setProperty("webdriver.chrome.driver", "src/main/resources/chromedriver.exe");
                driver = new ChromeDriver();
            } else if (isFirefox()) {
                FirefoxProfile profile = new FirefoxProfile();
                profile.setPreference("browser.startup.homepage_override.mstone", "ignore");
                profile.setPreference("browser.startup.homepage", "about:blank");
                driver = new FirefoxDriver(profile);
            } else {
                throw new RuntimeException("Given browser value is not valid: " + browser);
            }
            driver.manage().window().maximize();
            WebDriverRunner.setWebDriver(driver);
        } else {
            throw new RuntimeException("Browser value cannot be empty or null");
        }

        loginPageObject = open(baseUrl, LoginPageObject.class); // This one is line no: 153

        loginPageObject.userLogin(entry.get("Username"), entry.get("Password"));

// LoginPageObject

    public void doLogin(String username, String password) {
        $(By.id("USER")).setValue(username);
        $(By.id("PASSWORD")).setValue(password);
        $(byText("Log in")).click();
        CommonPageObjects.waitUntilPagesIsLoaded();
    }
@simple-elf
Contributor

loginPageObject = open(baseUrl, LoginPageObject.class);
Looks like you have PageObject =)

Maybe bug is here Navigator.java#L72

if (isIE()) Selenide.switchTo().alert().authenticateUsing(new UserAndPassword(domain + login, password));

And that line also mention in #320

@simple-elf
Contributor

Created pull request #369

@simple-elf
Contributor

@anilreddy please switch back to 3.5 and wait for fix in new versions

@asolntsev asolntsev added ready and removed cannot preproduce labels Aug 9, 2016
@asolntsev
Member

@anilreddy I hope this issue is now fixed by PR #369

@asolntsev asolntsev self-assigned this Aug 9, 2016
@asolntsev asolntsev added this to the 3.9 milestone Aug 9, 2016
@asolntsev
Member

I have merged the fix and released selenide 3.8.1
It will appear in maven central repo in few hours.

@asolntsev asolntsev closed this Aug 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment