Basic outline of the problem:
I have a selenium web-driver test that is meant to perform a signup for a new customer on a website. In order to complete the signup process i need to enter credit card data. All payment information needs to be enter in to a payment gateway that's hosted within a iframe.
Now to my problem, when running my test locally it passes with out any problems. My web-driver test is able to locate all objects.
But when try to run it on our Jenkins build server we get an error saying that Jenkins cant find the iframe:
Caused by: org.openqa.selenium.NoSuchFrameException: Unable to locate frame: zuora-iframe
Build info: version: '2.43.0', revision: 'accb3003b9fb8f7cae30f9669b4c594a065396a6', time: '2014-09-09 22:22:51'
System info: host: 'JENKINS', ip: '192.168.0.112', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_20'
Driver info: driver.version: unknown
at .FirefoxDriver.prototype.switchToFrame(file:///C:/Windows/TEMP/anonymous4949736922419206681webdriver-profile/extensions/fxdriver#googlecode.com/components/driver-component.js:9687:5)
at .DelayedCommand.prototype.executeInternal_/h(file:///C:/Windows/TEMP/anonymous4949736922419206681webdriver-profile/extensions/fxdriver#googlecode.com/components/command-processor.js:11612:16)
at .fxdriver.Timer.prototype.setTimeout/<.notify(file:///C:/Windows/TEMP/anonymous4949736922419206681webdriver-profile/extensions/fxdriver#googlecode.com/components/command-processor.js:548:5)
Results :
Tests in error:
sigupTest(se.pp.home.seleniumtest.sigupTest): Unable to locate frame: zuora-iframe(..)
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[ERROR] There are test failures.
In the test im using driver.switchTo().frame("zuora-iframe");to switch between the frames.
Related
Starting ChromeDriver 89.0.4389.90 (62eb262cdaae9ef819aadd778193781455ec7a49-refs/branch-heads/4389#{#1534}) on port 30551
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[ERROR] Tests run: 4, Failures: 2, Errors: 0, Skipped: 2, Time elapsed: 149.547 s <<< FAILURE! - in TestSuite
[ERROR] BrowserSelection(Cucumberoption.HomepageRunner) Time elapsed: 149.258 s <<< FAILURE!
org.openqa.selenium.WebDriverException:
unknown error: DevToolsActivePort file doesn't exist
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'ip-172-31-49-149', ip: '172.31.49.149', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-1041-aws', java.version: '11.0.10'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x562952783379
Make sure your Chrome browser version is compatible with your ChromeDriver version. Your ChromeDriver is 89.0.4389.90, so Chrome Browser version on your Jenkins agents should be 89 as well.
Type your command here, but i think it occurs because you forgot to specify to run browser in headless mode
Scenario:
Running tests from docker container, in docker container.
Results:
Tests fail with below errors:
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
T E S T S
Running org.hobsoft.docker.mavenchrome.BrowserTest
Starting ChromeDriver 84.0.4147.30 (48b3e868b4cc0aa7e8149519690b6f6949e110a8-refs/branch-heads/4147#{#310}) on port 16079
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[1594905471.000][SEVERE]: bind() failed: Cannot assign requested address (99)
ChromeDriver was started successfully.
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.28 sec <<< FAILURE! - in org.hobsoft.docker.mavenchrome.BrowserTest
canDuck(org.hobsoft.docker.mavenchrome.BrowserTest) Time elapsed: 1.274 sec <<< ERROR!
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '3cf859c01b07', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.76-linuxkit', java.version: '1.8.0_252'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x55bb64b8aea9
Root cause: Cause lays in trying to launch a browser in the container.
Fix: Launch selenium in headless mode in your tests.
For Java, this is shown as below.
ChromeOptions options = new ChromeOptions().setHeadless(true);
WebDriver driver = new ChromeDriver(options);
Results: Now tests run successfully, without any errors.
I am running my selenium tests in IE in a Windows VM with the help of Jenkins. When running java -jar jenkins.war, my suite is working fine..
But when Jenkins is running as a service, browser is not opening and always it is failing.
I have opened the service properties and given Allow service to interact with desktop.
The alternate way I am running java -jar jenkins.war as a start up.. But this is starting jenkins when I login VM but if some circumstances due to windows patch update if machine gets restarted this is not working until I login the VM which is not i want.
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73), userDataDir=C:\Windows\TEMP\scoped_dir6052_18573}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=70.0.3538.102, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=false, acceptInsecureCerts=false, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, setWindowRect=true, unexpectedAlertBehaviour=}]
Session ID: e6ef32b1e294ce9644a5078d9b8bf8c4
Failed ***********
Started InternetExplorerDriver server (32-bit)
2.51.0.0
Listening on port 45007
Only local connections are allowed
org.openqa.selenium.UnhandledAlertException: Modal dialog present:
Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:18:15'
System info: host: 'xx-xx-xx', ip: 'xx.xx.xxx.xxx', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_191'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, pageLoadStrategy=normal, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:45007/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
Session ID: dbbe2316-a3b3-4e39-82e3-04dae698ec73
Nov 16, 2018 6:17:43 PM org.openqa.selenium.support.ui.ExpectedConditions findElement
WARNING: WebDriverException thrown by findElement(By.id: txtUserName)
org.openqa.selenium.UnhandledAlertException: Modal dialog present:
Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:18:15'
System info: host: 'xxx-xx-xx', ip: 'xx.xx.xxx.xxx', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_191'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Error log states that your test failed because of:
org.openqa.selenium.UnhandledAlertException: Modal dialog present
It happens when some alert appeared and was not properly handled by your test. To fix it you need to add a logic to handle alert before you call a method to look for an element findElement(By.id("txtUserName")). The code might look like this:
try {
Alert alert = driver.switchTo().alert();
System.out.println("Alert appeared. Text= " + alert.getText());
alert.accept();
} catch (NoAlertPresentException ignored) {
//if alert is not present for some reason we don't want to fail and can continue a test
}
or you can wrap to a findElement call with a try catch, then close the alert, and try your logic again:
WebElement el;
try {
el = findElement(By.id("txtUserName"));
} catch (UnhandledAlertException f) {
try {
Alert alert = driver.switchTo().alert();
System.out.println("Alert appeared. Text= " + alert.getText());
alert.accept();
el = findElement(By.id("txtUserName"));
} catch (NoAlertPresentException ignored) {
//if alert is not present for some reason we don't want to fail and can continue a test
}
}
I am a beginner and installed appium to run selenium scripts from eclipse. I have also tried the same kind of code with app path as
/Users/path to.app
I launched appium with inspector and then executed the above code . I ended up with the following error
Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.46.0', revision: '87c69e2', time: '2015-06-04 16:17:10'
System info: host: 'vishal.local', ip: '192.168.1.16', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.3', java.version: '1.8.0_40-ea'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:155)
at catietest.CatieTest.setUp(CatieTest.java:34)
at catietest.CatieTest.main(CatieTest.java:18)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to 0.0.0.0:4723 [/0.0.0.0] failed: Connection refused
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:143)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:89)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:134)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:578)
... 5 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:204)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
... 18 more
I also tried to change the appDir path as "/Users/path to /Debug-iphonesimulator"
Even then I got the same error.
Pls provide me a solution
Make sure you have added selenium stand alone jar to your project reference jars.
And if you are executing test cases on iOS then make sure you are pointing towards http://0.0.0.0:4723/wd/hub.
If you are executing test cases on Android make sure it is pointing towards https://127.0.0.1:4723/wd/hub.
Before launching appium server make sure you have set the ANDROID_HOME environment variable by hitting the command:
Apples-MacBook-Pro-2:~ apple$ export ANDROID_HOME="/usr/local/Cellar/android-sdk/24.4.1_1"
then start the appium server and execute your test.
I'm trying to set up geb functional testing in Grails, then I get "chrome failed to start". Could anyone help me out?
Exception Details:
Starting ChromeDriver 2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf) on port 9374
Only local connections are allowed.
Failure: |
unauthorized login to the home page(com.myapp.HomeFunctionalSpec)
|
geb.driver.DriverCreationException: failed to create driver from callback 'script1426780645607568441896$_run_closure1#b0894c'
at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:35)
at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy:80)
at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:30)
at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:79)
at geb.Configuration.createDriver(Configuration.groovy:354)
at geb.Configuration.getDriver(Configuration.groovy:343)
at geb.Browser.getDriver(Browser.groovy:105)
at geb.Browser.clearCookies(Browser.groovy:483)
at geb.Browser.clearCookiesQuietly(Browser.groovy:491)
at geb.spock.GebSpec.resetBrowser(GebSpec.groovy:45)
at geb.spock.GebSpec.cleanup(GebSpec.groovy:67)
Caused by: org.openqa.selenium.WebDriverException: unknown error: chrome failed to start
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 586 milliseconds
Build info: version: '2.41.0', revision: '3192d8a6c4449dc285928ba024779344f5423c58', time: '2014-03-27 11:29:39'
System info: host: 'ILWS011', ip: '192.168.0.107', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_51'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.chrome.ChromeDriver.startSession(ChromeDriver.java:181)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:160)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:149)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:106)
at script1426780645607568441896.run_closure1(script1426780645607568441896.groovy:5)
at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:29)
... 10 more
Below is the BuildConfig.groovy
def gebVersion = "0.9.2"
def seleniumVersion = "2.41.0"
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
....
test "org.apache.httpcomponents:httpcore:4.2.3"
test "org.gebish:geb-spock:$gebVersion"
test "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
test "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
}
plugins {
// plugins needed at test environment
test ":geb:$gebVersion"
}
test/functional/GebGonfig.groovy
import org.openqa.selenium.chrome.ChromeDriver
driver = {
System.setProperty("webdriver.chrome.driver", "C://chromedriver//chromedriver.exe")
new ChromeDriver()
}
I'm using the Chromedriver2.14, and putting it in C:/chromedriver/
Did I set everything right? Are the versions matching with each other?
It's maybe because of old selenium Version. Use 2.45 and the newest webdriver.