Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Implicit and Explicit wait not working for Safari driver #5860

Closed
lukeis opened this issue Mar 4, 2016 · 12 comments
Closed

Implicit and Explicit wait not working for Safari driver #5860

lukeis opened this issue Mar 4, 2016 · 12 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 4, 2016

Originally reported on Google Code with ID 5860

Implicit and Explicit wait are not working for Safari driver .Both wait statements are
giving Timeout Exception .

Here is the code :


public class YahooLoginTest {

    WebDriver driver = new SafariDriver();

    public void testYahoo()
    {
        driver.get("http://www.yahoo.com");
        //driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

        WebElement myDynamicElement = (new WebDriverWait(driver, 10)).until(ExpectedConditions.presenceOfElementLocated(By.name("login")));

        driver.findElement(By.linkText("Sign In")).click();
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        driver.findElement(By.name("login")).sendKeys("XYz");
        driver.findElement(By.name("passwd")).sendKeys("XYz");
        driver.findElement(By.name(".save")).click();
    }

    public static void main(String args[])
    {
        YahooLoginTest test = new YahooLoginTest();
        test.testYahoo();

    }


The Exception is :

Jul 1, 2013 10:53:16 PM org.openqa.selenium.safari.SafariDriverServer start
INFO: Server started on port 34922
Jul 1, 2013 10:53:19 PM org.openqa.selenium.safari.SafariDriverChannelHandler$1 operationComplete
INFO: Connection opened
Exception in thread "main" org.openqa.selenium.TimeoutException: Timed out after 10
seconds waiting for presence of element located by: By.name: login
Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:32:38'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.3', java.version:
'1.6.0_45'
Driver info: driver.version: unknown
    at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:259)
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:228)
    at com.mqm.automation.YahooLoginTest.testYahoo(YahooLoginTest.java:33)
    at com.mqm.automation.YahooLoginTest.main(YahooLoginTestjava:53)
Caused by: org.openqa.selenium.NoSuchElementException: Could not find element: {"using":"name","value":"login"}
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 20 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:32:38'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.3', java.version:
'1.6.0_45'
Session ID: null
Driver info: org.openqa.selenium.safari.SafariDriver
Capabilities [{platform=MAC, javascriptEnabled=true, cssSelectorsEnabled=true, secureSsl=true,
browserName=safari, takesScreenshot=true, version=6.0.4}]
    at sun.reflect.GeneratedConstructorAccessor3.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:307)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByName(RemoteWebDriver.java:380)
    at org.openqa.selenium.By$ByName.findElement(By.java:292)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:299)
    at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:522)
    at org.openqa.selenium.support.ui.ExpectedConditions.access$0(ExpectedConditions.java:520)
    at org.openqa.selenium.support.ui.ExpectedConditions$3.apply(ExpectedConditions.java:106)
    at org.openqa.selenium.support.ui.ExpectedConditions$3.apply(ExpectedConditions.java:1)
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:208)
    ... 2 more


Reported by madhu.kusumakar on 2013-07-02 05:58:21

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

In addition to the Issues #5860,Please find the system info :

OS :Mac 10.8.3
Browser :Safari
Version :6.0.4
WebDriver version :selenium-server-standalone-2.33.0

Please let me know if you need more information.Thanks .

Reported by madhu.kusumakar on 2013-07-03 06:50:02

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Could you please update about the issue ? Thanks

Reported by madhu.kusumakar on 2013-07-11 06:52:51

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I don't see any updates about the issue we are having in our environment.If this is
not reproducible in your environment,Please do let us know .We are up to provide more
information about it but leaving it unattended is not the user can expect.Thanks

Reported by madhu.kusumakar on 2013-07-20 00:12:20

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by barancev on 2013-08-08 23:02:57

  • Labels added: Browser-Safari

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Any update on this?  I am also having problems with waits using the latest Selenium
driver (2.35.0) and the safari driver on Mac OS X 10.7.5

I get the following error
org.openqa.selenium.TimeoutException: Timed out after 10 seconds waiting for presence
of element located by: By.selector:...

Here is the code it is failing on.  This passes in IE, FF & Chrome
wait.until(ExpectedConditions.presenceOfElementLocated(headerLocator));

Reported by owenfletcher on 2013-10-01 12:09:50

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by jmleyba on 2013-10-01 16:14:18

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

No updates so far and waits are still not working in 2.35.0.I am tired of using Thread.sleep
..looks ugly.

Reported by madhu.kusumakar on 2013-10-03 21:11:39

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

The scenario is just wrong. Instead of

driver.get("http://www.yahoo.com");
WebElement myDynamicElement = (new WebDriverWait(driver, 10)).until(ExpectedConditions.presenceOfElementLocated(By.name("login")));
driver.findElement(By.linkText("Sign In")).click();

there should be

driver.get("http://www.yahoo.com");
driver.findElement(By.linkText("Sign In")).click();
WebElement myDynamicElement = (new WebDriverWait(driver, 10)).until(ExpectedConditions.presenceOfElementLocated(By.name("login")));

Reported by barancev on 2013-11-02 17:54:40

  • Status changed: Invalid
  • Labels removed: Status-Untriaged

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I am also getting the similar issue only for the Safari. It works in Firefox.

Do let me know if you need any more information.

org.openqa.selenium.TimeoutException: Timed out awaiting response to command "sendKeysToElement"
after 30001 ms (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 30.02 seconds
Build info: version: '2.33.0', revision: '4ecaf82108b2a6cc6f006aae81961236eba93358',
time: '2013-05-22 12:00:17'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.5', java.version:
'1.6.0_51'
Session ID: null
Driver info: org.openqa.selenium.safari.SafariDriver
Capabilities [{platform=MAC, javascriptEnabled=true, cssSelectorsEnabled=true, secureSsl=true,
browserName=safari, takesScreenshot=true, version=6.0.5}]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
    at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
    at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:89)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.openqa.selenium.support.pagefactory.internal.LocatingElementHandler.invoke(LocatingElementHandler.java:41)
    at com.sun.proxy.$Proxy13.sendKeys(Unknown Source)
    at com.web.selenium.pages.github.GitHubHomePage.setUserLogin(GitHubHomePage.java:71)
    at com.web.selenium.pages.github.testcases.GitHubHomePageTest.validateUserLogin(GitHubHomePageTest.java:36)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:128)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1203)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1128)
    at org.testng.TestNG.run(TestNG.java:1036)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

Reported by upendra366 on 2013-11-06 14:00:31

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Please find my sample Code

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.safari.SafariDriver;

public class Example  {

    public static void main(String[] args) {
        WebDriver driver = new SafariDriver();

        driver.get("https://github.com");

        // Find the text input element by its name
        WebElement element = driver.findElement(By.name("user[login]"));

        // Enter something to search for
        element.sendKeys("User");

        // Now submit the form. WebDriver will find the form for us from the element
        element.submit();

        // Check the title of the page
        System.out.println("Page title is: " + driver.getTitle());
    }
}


Error Logs ::


ov 6, 2013 7:34:00 PM org.openqa.selenium.safari.SafariDriverServer start
INFO: Server started on port 37944
Nov 6, 2013 7:34:01 PM org.openqa.selenium.safari.SafariDriverChannelHandler$1 operationComplete
INFO: Connection opened
Exception in thread "main" org.openqa.selenium.TimeoutException: Timed out awaiting
response to command "sendKeysToElement" after 30000 ms (WARNING: The server did not
provide any stacktrace information)
Command duration or timeout: 30.02 seconds
Build info: version: '2.33.0', revision: '4ecaf82108b2a6cc6f006aae81961236eba93358',
time: '2013-05-22 12:00:17'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.5', java.version:
'1.6.0_51'
Session ID: null
Driver info: org.openqa.selenium.safari.SafariDriver
Capabilities [{platform=MAC, javascriptEnabled=true, cssSelectorsEnabled=true, secureSsl=true,
browserName=safari, takesScreenshot=true, version=6.0.5}]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
    at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
    at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:89)
    at com.web.selenium.standalone.samples.Example.main(Example.java:23)

Reported by upendra366 on 2013-11-06 14:07:06

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

@upendra366: Please raise a new issue, it is completely unrelated to the original one.

Reported by barancev on 2013-11-06 14:38:29

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

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

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 4, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant