Alright, I think I've made a little progress. We passed the proxy URL to 
the SauceLabsDriverFactory like this:
new SauceLabsDriverFactory('testserver.company.com:443/wd/hub')
and now we're having a different stack trace - it seems the tunnel is 
created successfully (I see "Sauce Connect is up, you may start your 
tests."), but somehow the test can't connect to the proxy. After 
"Unexpected status line:" in the exception message there are five numbers 
in boxes that I can only see in BeyondCompare. The full stack trace is 
below. Do you have any ideas what's going on?
test.TestClass > classMethod FAILED
    geb.driver.DriverCreationException: failed to create driver from 
callback 'script15726565316811155837962$_run_closure2@65de3495'
        at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.
groovy:35)
        at geb.driver.CachingDriverFactory.getDriver_closure4(
CachingDriverFactory.groovy:57)
        at geb.driver.CachingDriverFactory.getDriver_closure4(
CachingDriverFactory.groovy)
        at geb.driver.CachingDriverFactory$SimpleCache.get(
CachingDriverFactory.groovy:81)
        at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.
groovy:56)
        at geb.Configuration.createDriver(Configuration.groovy:675)
        at geb.Configuration.getDriver(Configuration.groovy:353)
        at geb.Browser.getDriver(Browser.groovy:160)
        at geb.navigator.factory.BrowserBackedNavigatorFactory.<init>(
BrowserBackedNavigatorFactory.groovy:31)
        at geb.Configuration.createNavigatorFactory(Configuration.groovy:413
)
        at geb.Browser.createNavigatorFactory(Browser.groovy:982)
        at geb.Browser.getNavigatorFactory(Browser.groovy:170)
        at geb.Page.init(Page.groovy:140)
        at geb.Browser.initialisePage(Browser.groovy:1116)
        at geb.Browser.createPage(Browser.groovy:829)
        at geb.Browser.to(Browser.groovy:537)
        at geb.Browser.to(Browser.groovy:526)
        at geb.spock.GebSpec.methodMissing(GebSpec.groovy:60)
        at login.LoginTrait$Trait$Helper.logIn(LoginTrait.groovy:7)
        at test.TestClass.setupSpec(TestClass.groovy:8)

        Caused by:
        java.lang.reflect.InvocationTargetException
            at geb.driver.CloudDriverFactory.create(CloudDriverFactory.
groovy:51)
            at script15726565316811155837962.run_closure2(
script15726565316811155837962.groovy:20)
            at script15726565316811155837962.run_closure2(
script15726565316811155837962.groovy)
            at geb.driver.CallbackDriverFactory.getDriver(
CallbackDriverFactory.groovy:29)
            ... 19 more

            Caused by:
            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: '3.141.59', revision: 'e82be7d358', time: 
'2018-11-14T08:17:03'
            System info: host: 'server', ip: '1.2.3.4', os.name: 'Linux', os
.arch: 'amd64', os.version: '3.10.0-957.21.3.el7.x86_64', java.version: 
'1.8.0_212'
            Driver info: driver.version: RemoteWebDriver
                at org.openqa.selenium.remote.RemoteWebDriver.execute(
RemoteWebDriver.java:573)
                at org.openqa.selenium.remote.RemoteWebDriver.startSession(
RemoteWebDriver.java:213)
                at org.openqa.selenium.remote.RemoteWebDriver.<init>(
RemoteWebDriver.java:131)
                at org.openqa.selenium.remote.RemoteWebDriver.<init>(
RemoteWebDriver.java:144)
                ... 23 more

                Caused by:
                java.net.ProtocolException: Unexpected status line:      
                    at okhttp3.internal.http.StatusLine.parse(StatusLine.
java:69)
                    at okhttp3.internal.http1.Http1Codec.readResponseHeaders
(Http1Codec.java:189)
                    at okhttp3.internal.http.CallServerInterceptor.intercept
(CallServerInterceptor.java:88)
                    at okhttp3.internal.http.RealInterceptorChain.proceed(
RealInterceptorChain.java:147)
                    at okhttp3.internal.http.RealInterceptorChain.proceed(
RealInterceptorChain.java:121)
                    at org.openqa.selenium.remote.internal.
OkHttpClient$Factory$1.lambda$createClient$1(OkHttpClient.java:152)
                    at okhttp3.internal.http.RealInterceptorChain.proceed(
RealInterceptorChain.java:147)
                    at okhttp3.internal.connection.ConnectInterceptor.
intercept(ConnectInterceptor.java:45)
                    at okhttp3.internal.http.RealInterceptorChain.proceed(
RealInterceptorChain.java:147)
                    at okhttp3.internal.http.RealInterceptorChain.proceed(
RealInterceptorChain.java:121)
                    at okhttp3.internal.cache.CacheInterceptor.intercept(
CacheInterceptor.java:93)
                    at okhttp3.internal.http.RealInterceptorChain.proceed(
RealInterceptorChain.java:147)
                    at okhttp3.internal.http.RealInterceptorChain.proceed(
RealInterceptorChain.java:121)
                    at okhttp3.internal.http.BridgeInterceptor.intercept(
BridgeInterceptor.java:93)
                    at okhttp3.internal.http.RealInterceptorChain.proceed(
RealInterceptorChain.java:147)
                    at okhttp3.internal.http.RetryAndFollowUpInterceptor.
intercept(RetryAndFollowUpInterceptor.java:126)
                    at okhttp3.internal.http.RealInterceptorChain.proceed(
RealInterceptorChain.java:147)
                    at okhttp3.internal.http.RealInterceptorChain.proceed(
RealInterceptorChain.java:121)
                    at okhttp3.RealCall.getResponseWithInterceptorChain(
RealCall.java:200)
                    at okhttp3.RealCall.execute(RealCall.java:77)
                    at org.openqa.selenium.remote.internal.OkHttpClient.
execute(OkHttpClient.java:103)
                    at org.openqa.selenium.remote.ProtocolHandshake.
createSession(ProtocolHandshake.java:105)
                    at org.openqa.selenium.remote.ProtocolHandshake.
createSession(ProtocolHandshake.java:74)
                    at org.openqa.selenium.remote.HttpCommandExecutor.
execute(HttpCommandExecutor.java:136)
                    at org.openqa.selenium.remote.RemoteWebDriver.execute(
RemoteWebDriver.java:552)
                    ... 26 more



On Friday, November 1, 2019 at 7:47:48 AM UTC-5, Ben Frey wrote:
>
> That's what I was afraid of. I've opened a ticket with our development 
> support folks and hopefully I'll be able to talk to someone at SauceLabs as 
> well. I tried adding in the configurations that are in the WDIO version of 
> the project (namely parentTunnel and tunnelIdentifier):
> capabilities: [
>     {
>         maxInstances: 5,
>         browserName: 'internet explorer',
>         parentTunnel: 'company_admin',
>         tunnelIdentifier: 'company-ha-tunnel',
>     }
> ],
>  so my browsers block looks like this:
> browsers {
>     create('internet explorer') {
>         capabilities(
>                 browserName: 'Internet Explorer',
>                 platform: 'Windows 7',
>                 version: '11',
>                 parentTunnel: 'company_admin',
>                 tunnelIdentifier: 'company-ha-tunnel'
>         )
>     }
> }
> but that didn't seem to help.
>
>
>
> On Friday, November 1, 2019 at 6:48:27 AM UTC-5, Marcin Erdmann wrote:
>>
>> Hi Ben,
>>
>> Thanks for providing the sample, it's very helpful. I checked it out and 
>> executed the following:
>>
>> [erdi@mbp /tmp/geb-sauce-test (master *)]$ ./gradlew allSauceLabsTest 
>> --console plain
>> > Task :compileJava NO-SOURCE
>> > Task :compileGroovy NO-SOURCE
>> > Task :processResources NO-SOURCE
>> > Task :classes UP-TO-DATE
>>
>> > Task :unpackSauceConnect
>> [DEBUG] Expanding: 
>> /private/tmp/geb-sauce-test/build/sauce-connect/sc-4.5.4-osx.zip into 
>> /private/tmp/geb-sauce-test/build/sauce-connect
>> [DEBUG] expand complete
>>
>> > Task :openSauceTunnelInBackground
>> > Task :compileTestJava NO-SOURCE
>> > Task :compileTestGroovy
>> > Task :processTestResources
>> > Task :testClasses
>> > Task :internetExplorerTest
>> > Task :internetExplorerDecorateReports
>> > Task :closeSauceTunnel
>> > Task :allSauceLabsTests
>>
>> BUILD SUCCESSFUL in 43s
>> 7 actionable tasks: 7 executed
>>
>>
>> This is the test run from sauce labs: 
>> https://app.saucelabs.com/tests/d85c832db0a349f882a93476e9920e40
>>
>> I then changed this line in GebConfig:
>>
>> new SauceLabsDriverFactory().create(sauceLabsBrowser, username, accessKey)
>>
>>
>> to 
>>
>> new SauceLabsDriverFactory().create(sauceLabsBrowser, "", "", [username: 
>> username, accessKey: accessKey])
>>
>>
>> And also got a success.
>>
>> All of this suggests to me that the problem is not in Geb or your code 
>> but it's in the environment in which you are running the tests. Something 
>> is clearly interfering with the requests that you are sending to SauceLabs.
>>
>>
>> On Wed, Oct 30, 2019 at 2:07 AM Ben Frey <[email protected]> wrote:
>>
>>> Ok, I've got my minimum example: 
>>> https://github.com/spartanhooah/geb-sauce-test
>>>
>>> I did try the alternate method of creating the SauceLabsDriverFactory 
>>> but that resulted in these messages:
>>>
>>> sauce-connect: <timestamp> - Error in checkUpdate: couldn't connect to 
>>> https://saucelabs.com/versions.json: Get 
>>> https://saucelabs.com/versions.json: malformed HTTP response 
>>> "\x15\x03\x03\x00\x02\x02"
>>> sauce-connect: <timestamp> - started scproxy on port 37318.
>>> sauce-connect: <timestamp> - Please wait for 'you may start your tests' 
>>> to start your tests.
>>> sauce-connect: <timestamp> - failed to check for existing tunnels
>>> sauce-connect: <timestamp> - Sauce Connect could not establish a 
>>> connection
>>> sauce-connect: <timestamp> - Please check your firewall and proxy 
>>> settings
>>> The command-line arguments for sc were
>>> --user <me> --api-key **** --se-port 4445 --proxy test.company.com:443
>>>
>>>
>>>
>>> On Monday, October 28, 2019 at 9:45:34 PM UTC, Marcin Erdmann wrote:
>>>>
>>>> A tunnel (if you are talking about a Sauce Labs tunnel) will not be 
>>>> needed because we won't be accessing anything specific to your company - 
>>>> gebish.org is accessible on the public Internet. Unless you are 
>>>> talking about some proxy that you are using which might potentially be 
>>>> stripping out the credentials from the url... (which are added like this: 
>>>> https://github.com/geb/geb/blob/master/module/geb-core/src/main/groovy/geb/driver/SauceLabsDriverFactory.groovy#L28).
>>>>  
>>>> If that's the case then it also seems possible to authenticate via browser 
>>>> capabilities (
>>>> https://wiki.saucelabs.com/display/DOCS/Best+Practice%3A+Use+Environment+Variables+for+Authentication+Credentials
>>>>  and 
>>>> expand the full example). Maybe that will work in your setup... To try it 
>>>> out you'll need to change your config script from:
>>>>
>>>> new SauceLabsDriverFactory().create(sauceLabsBrowser, username, 
>>>> accessKey)
>>>>
>>>> to
>>>>
>>>> new SauceLabsDriverFactory().create(sauceLabsBrowser, "", "", 
>>>> [username: username, accessKey: accessKey])
>>>>
>>>>
>>>> On Mon, Oct 28, 2019 at 9:05 PM Ben Frey <[email protected]> wrote:
>>>>
>>>>>  Oh, I see. I'll start working on that tomorrow, I hope. Although I'm 
>>>>> still not sure about the SauceLabs portion since it involves a tunnel 
>>>>> that's hosted by my company. Is that something I can mock out or 
>>>>> otherwise 
>>>>> deal with?
>>>>>
>>>>> -- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "Geb User Mailing List" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to [email protected].
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/geb-user/665e3665-1fcf-4f51-82f3-afbdf0f5b88e%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/geb-user/665e3665-1fcf-4f51-82f3-afbdf0f5b88e%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Geb User Mailing List" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/geb-user/d8e0dc21-c067-45c1-8a11-a0986fdfe475%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/geb-user/d8e0dc21-c067-45c1-8a11-a0986fdfe475%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/a1a60496-c8c0-4d16-8472-3c1b7a9b2407%40googlegroups.com.

Reply via email to