Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support browser using proxy for UI automation #924

Closed
ptrthomas opened this issue Oct 17, 2019 · 42 comments
Closed

Support browser using proxy for UI automation #924

ptrthomas opened this issue Oct 17, 2019 · 42 comments
Milestone

Comments

@ptrthomas
Copy link
Member

ptrthomas commented Oct 17, 2019

totally missed this ! propose adding a proxy key to the configure driver

good issue for potential hacktoberfest contributors !

you will need to support this for both the native Chrome and the WebDriver paths. really don't know about mobile, but assume it is not needed

@ptrthomas
Copy link
Member Author

assigned to @t-gok as per #902 (comment)

@ptrthomas
Copy link
Member Author

attention all watchers - I tried to fix this, but it just doesn't seem to work - so would appreciate some help. even the native chrome doesn't work but I suspect is because my chrome install is corp-managed

this commit has the details: 0aeefb6

also we have switched from desiredCapabilities to capabilities for WebDriver W3C

references for anyone willing to help / contribute:

https://w3c.github.io/webdriver/#proxy
https://www.linuxbabe.com/desktop-linux/configure-proxy-chromium-google-chrome-command-line

@paaco
Copy link
Contributor

paaco commented Jan 21, 2020

Hi @ptrthomas, I can confirm that for Firefox the proxy setting only works with my 'headless' fix, because of "alwaysMatch" in the W3C capabilities. If you leave that block out, the proxy object is not picked up. Here is a short log when it works:

1 > User-Agent: Apache-HttpClient/4.5.5 (Java/1.8.0_241)
{"capabilities":{"alwaysMatch":{"browserName":"firefox","proxy":{"proxyType":"manual","sslProxy":"127.0.0.1"},"moz:firefoxOptions":{"args":["-headless"]}}}}

09:15:26.934 [geckodriver_1579594524005] DEBUG com.intuit.karate.driver.geckodriver_1579594524005 - 1579594526931 mozrunner::runner INFO Running command: "C:\Program Files\Mozilla Firefox\firefox.exe" "-marionette" "-headless" "-foreground" "-no-remote" "-profile" "C:\Temp\rust_mozprofiledrvpB0"
09:15:27.042 [geckodriver_1579594524005] DEBUG com.intuit.karate.driver.geckodriver_1579594524005 - *** You are running in headless mode.
...
09:15:31.265 [geckodriver_1579594524005] DEBUG com.intuit.karate.driver.geckodriver_1579594524005 - 1579594531265 Marionette INFO Proxy settings initialised: {"proxyType":"manual","sslProxy":"127.0.0.1:80"}

I guess a possible fix is to always add "alwaysMatch" when setting up the "capabilities" object.

@ptrthomas
Copy link
Member Author

@paaco this is great, thanks. can I request you for another PR ? you have mentioned alwaysMatch a couple times and looks like that is the way to go. I think with this out of the way I'd look for a 0.9.5 final release. by any chance have you tested the chrome docker container, wanted to see if that was ok after recent fixes to develop

@paaco
Copy link
Contributor

paaco commented Jan 21, 2020

@ptrthomas I only used the chrome docker container for very limited testing, but it seems to work fine with a very recent pull of develop when running one test at a time just now (latest image).

Using a Scenario Outline will only run the first test and fail the others immediately with "driver config / start failed" while Chrome is restarting in the container. Not sure if that is intended or not.
I just copy/paste the code from the documentation here: https://github.com/intuit/karate/tree/develop/karate-core#karate-chrome

The proxy setting is not honored, as you already said in #924 (comment). I will test adding the alwaysMatch to all driver code paths and issue a PR if that fixes it.

@ptrthomas
Copy link
Member Author

@paaco thanks, yes do try for a PR. regarding Docker if you have the time, take a look at instructions to build the Docker image locally: https://github.com/intuit/karate/wiki/Developer-Guide#docker-images

I'll be testing it in a bit - but always helps to have a second opinion. I'll also look into Scenario Outline problem you mentioned

@paaco
Copy link
Contributor

paaco commented Jan 21, 2020

Proxy setting ONLY tested and verified with Firefox (geckodriver) and Chrome 78 (chromedriver). 'chrome' devtools protocol with docker-image doesn't respect the proxy settings. Probably that is set differently. I can check that later.
But I have no ability to verify MsEdge or Safari.

@ptrthomas
Copy link
Member Author

Proxy setting ONLY tested and verified with Firefox (geckodriver) and Chrome 78 (chromedriver).

more than enough ! thank you :)

@ptrthomas
Copy link
Member Author

@paaco would you happen to know the answer to this stack overflow question: https://stackoverflow.com/q/59875791/143475

@paaco
Copy link
Contributor

paaco commented Jan 25, 2020

@ptrthomas acceptInsecureCerts is a W3C Webdriver capability as specified here: https://www.w3.org/TR/webdriver/#capabilities
The capabilities object is created in DriverOptions with only browserName and proxy so at the moment Karate doesn't support it. But it's pretty easy to add support for acceptInsecureCerts there just like the proxy or headless setting. I can make a PR in a few days.

@ptrthomas
Copy link
Member Author

@paaco that would be great, thanks !

@ptrthomas
Copy link
Member Author

@paaco thanks a lot for the PR-s and with this I think a 0.9.5. final release can be cut

I have one idea and wanted to know what you think, especially for people wanting to experiment with RemoteWebDriver and SaaS providers (e.g. AWS just entered the game) - I was thinking if we add a webdriverCapabilities configure driver key which takes a JSON that will be passed as-is.

AWS capabilities: https://docs.aws.amazon.com/devicefarm/latest/testgrid/techref-support.html

does that make sense or would you suggest anything else.

@paaco
Copy link
Contributor

paaco commented Jan 28, 2020

@ptrthomas Yeah that could make sense and is easy enough to change.

acceptInsecureCerts is then automatically supported, just as all other currently uncoded features like AWS or exotic Chrome settings.

Drop the explicit headless support too and have users write moz:firefoxOptions/args/-headless inside webdriverCapabities themselves if they want. Would be more cumbersome but it takes away the invisible magic that occurs and sounds more like the Karate-way of doing.

The proxy setting is probably also better off inside webdriverCapabilities.

@ptrthomas
Copy link
Member Author

@paaco thanks, I'll go ahead and make this change ! this i just an optional thing and does not change what you already implemented (default kind of behavior)

@paaco
Copy link
Contributor

paaco commented Jan 28, 2020

@ptrthomas I prefer you remove it, it's not necessary anymore when you implement webdriverCapabilities. That way you have less code to maintain.

@ptrthomas
Copy link
Member Author

@paaco oh ok, I will make the change and hope you are ok with one more round of testing

ptrthomas added a commit that referenced this issue Jan 28, 2020
so the user can specify whatever is needed and we keep the karare side simple
this makes sense as there are so many options, eg saas / remote drivers
ptrthomas added a commit that referenced this issue Jan 28, 2020
ptrthomas added a commit that referenced this issue Jan 28, 2020
@paaco
Copy link
Contributor

paaco commented Jan 28, 2020

@ptrthomas You should have kept the "alwaysMatch" line here otherwise it won't work. db6b06b#r36998158

@paaco
Copy link
Contributor

paaco commented Jan 28, 2020

@ptrthomas Hmm. On second thought, just put 'browserName' inside 'alwaysMatch' by default.

You want to be able to add a "firstMatch" especially with RemoteWebDriver instances. That works how it is implemented right now.

ptrthomas added a commit that referenced this issue Jan 28, 2020
also updated chrome-web-driver to be w3c compliant for latest chrome version
some new problems with safari, will defer
@ptrthomas
Copy link
Member Author

@paaco ok take a look now

@paaco
Copy link
Contributor

paaco commented Jan 28, 2020

@ptrthomas It should do, but I think I prefer something like this:

  1. start with webDriverCapabilities
  2. if there's an alwaysMatch, putIfAbsent(browserName) in there
  3. otherwise add alwaysMatch and putIfAbsent(browserName) in there

This way the browserName always gets added to alwaysMatch and not to the capabilities root. Does that make sense?

@ptrthomas
Copy link
Member Author

@paaco ok how does it look now

@paaco
Copy link
Contributor

paaco commented Jan 28, 2020

@ptrthomas that looks pretty good, but I have to test it further tomorrow.

@paaco
Copy link
Contributor

paaco commented Jan 29, 2020

@ptrthomas Ok, I tested with both Firefox and Chrome and works as described above. I like it this way, it's very flexible.

@ptrthomas
Copy link
Member Author

@paaco thanks for all your help on this !

@ptrthomas
Copy link
Member Author

@paaco and all watching, I just made tweaks so that Karate can call a "remote" webdriver instance, here are the docs: https://github.com/intuit/karate/tree/develop/karate-core#webdriverurl

this should be of interest for those who want to use AWS and even for mobile testing. I tested this on Zalenium running locally

ptrthomas added a commit that referenced this issue Jan 30, 2020
also changes to what was discussed in #924
so now it is [webDriverSession] and not [webDriverCapabilities] so user has full control over the
webdriver POST to /session payload - which will take care of any remote / saas situation
and quirks of implementations like selenium grid
introduced [httpConfig] key and now you can configure the http client e.g. readTimeout which is
needed for aws as it can take a long time for a device / browser desktop to be provisioned
see readme edits for details
@ptrthomas
Copy link
Member Author

@paaco after some investigation of how selenium grid and aws works I decided it is better to allow the user to specify the whole payload of the JSON of which capabilities is one key.

please refer docs. I also had to tweak the logic again for alwaysMatch but I think it is ok for the default case, so take a look

docs: https://github.com/intuit/karate/tree/develop/karate-core#webdriversession

@paaco
Copy link
Contributor

paaco commented Jan 30, 2020

@ptrthomas Nice! I love it how you make things more generic. That is what Karate makes the real Swiss army knife of API testing.

@forlixdev
Copy link

forlixdev commented May 23, 2020

Hi. I tried the solutions proposed but it does not work for me:

  Scenario: try to use a proxy
    * def webUrlBase = "http://httpstat.us/"
    * def session = { capabilities: { browserName: 'firefox', proxy: { proxyType: 'manual', httpProxy: '127.0.0.1:8080' } } }
    * configure driver = { type: 'geckodriver', webDriverSession: '#(session)' }

    Given driver webUrlBase

It seems that the browser is not using the capabilities that were "suggested", from the log file:

09:28:02.872 [ForkJoinPool-1-worker-1] DEBUG com.intuit.karate - response time in milliseconds: 3049,83
1 < 200
1 < cache-control: no-cache
1 < content-length: 712
1 < content-type: application/json; charset=utf-8
1 < date: Sat, 23 May 2020 07:27:59 GMT
{"value":{"sessionId":"a04f2436-00ea-4430-8b71-a0e31bdb8327","capabilities":{"acceptInsecureCerts":false,"browserName":"firefox","browserVersion":"76.0.1","moz:accessibilityChecks":false,"moz:buildID":"20200508083352","moz:geckodriverVersion":"0.26.0","moz:headless":false,"moz:processID":27562,"moz:profile":"/tmp/rust_mozprofileIeK83P","moz:shutdownTimeout":60000,"moz:useNonSpecCompliantPointerOrigin":false,"moz:webdriverClick":true,"pageLoadStrategy":"normal","platformName":"linux","platformVersion":"5.6.13-300.fc32.x86_64","rotatable":false,"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify"}}}

I tried with geckodrive 0.26.0 + Firefox 76 and chromedriver 83.0.4103.39 +Chrome 83

@paaco
Copy link
Contributor

paaco commented May 23, 2020

@forlixdev Firefox is very picky about alwaysMatch, unlike Chrome, see #924 (comment)

Could you try:
* def session = { capabilities: { alwaysMatch: { browserName: 'firefox', proxy: { proxyType: 'manual', httpProxy: '127.0.0.1:8080' } } } }

@forlixdev
Copy link

Thank @paaco. I tried also before with Chrome but nothing, I'll retry with your suggestions with Firefox.

@forlixdev
Copy link

Ok, tested. It works with alwaysMatch. Thanks

SalilGupta12 added a commit to SalilGupta12/karate that referenced this issue Jul 27, 2020
* webauto: this is big, we have friendly locators

* webauto: move finder & mouse to interfaces
so that the method signatures are easier to read for those viewing via readme / doc links

* adjust maven profile for ui in hope that it works

* Revert "Add afterFeature and beforeFeature hooks, RunnerBuilder"

This reverts commit 88026a2

* Junit4 can run tests in parallel

* improve zip based on feedback and doc

* more doc updates based on feedback

* implemented waitForText() short-cut

* webauto: decided to rename waitForText() and waitForEnabled()

* Revert "Merge pull request karatelabs#871 from pshrm/develop"

This reverts commit cb905bd, reversing
changes made to 0da4f41.

* slight improve to timeline view tooltips

* additional tweak for karatelabs#826 replaces karatelabs#863

* unified cli for karate core somewhat karatelabs#827
in the future, the netty picocli has to be merged and we also would have native html parallel reports
but for now, we can start testing the vs code plugin for this
parallel execution will now generate native html report and continuously update the results-json.txt
which the plugin can read and update etc

* default to proper karate runner system always

* fix bugs with cli runner and switch netty fatjar to runner builder karatelabs#827

* big improvement to intellij ide support
the test results will have timings and logs associated correctly
also using the unified karate short-syntax for scenario / line number etc

* webauto: decided to use 1 based indexing for friendly locators
trust me it jst did not feel right with zero based indexing

* thats what happens when you dont run the local tests

* webauto: focus() breaks on fancy input fields, fixed

* hooks expanded for all cases, beforeAll() afterAll()
and even beforeStep() afterStep()

* webauto: improve target api design

* webauto: handle cookie failure in web-driver

* fix for focus() js and chrome cookie error routine

* some long pending call vs read doc

* minor cosmetic readme tweak

* added a couple more crazy examples

* webauto: reduce intensity of friendly locator search

* gracefully fail if browser / input field type
does not support moving text cursor to end

* webauto: implemented waitForResultCount()

* better error message if relative path does not exist

* draft version of vscode debug adapter protocol implementation

* move debug server test to junit so that karate-apache is on cp

* Add resources methods to the Builder

* vscode debug server start option
for both standalone jar cli and the runner, so this can be fired in a maven project
also upgraded picocli to latest for the -d arity 0..1 feature

* minor loggin changes to debug server

* use of waitForResultCount

* debug adapter decoder bad logic fixed

* debug server now supports called features
almost everything, step-in, step-out, multiple breakpoints

* get build to work on windows and clean up
this breaks karatelabs#751 but needs investigation / reopen

* refactor / cleanup to prev commit ref karatelabs#751

* debug adapter protocol: implemented repl evaluate and step-back

* debug server: hot reload of code works
so after editing a feature in the editor, the restart button on the debug toolbar
needs to be used to trigger the hot-reload
limitation for now: only line edits, no line adds or deletes will be supported
but still, this is going to be awesome

* tweak to fileutils for absolute file paths
which does come into play when doing vs code debug sessions

* debug: another breakthrough - we can debug parallel threads
and now the vscode launch can accept the whole command-line parallel-threads tags and all

* cleanup for prev commit

* standalone jar cli error stack trace trimmed
also docs here and there

* debug server proper optimization of netty decoder

* improve prev commit even more

* some license headers were missing, added

* fix relative path resolution, no more weird ///

* wip distributed testing capability
abstraction of job server and executor nodes call back over http
wip docker image that includes karate standalone which acts as an agent
we can get all reports and logs back from remote executors - todo aggregate

* jobdist: wip continues
karate-chrome docker container now based on java+maven and with standalone jar
improve supervisord for shutdown from within a docker container via bash command
improved / cleanup of job-executor code

* jobdist: reports aggregation working after scale-out
able to convert cucumber json back to result java objects on server

* distjob: wip ui test videos can be retrieved
now just need to fiddle with paths and some env props in java
todo background step cucumber-json conversion

* distjob: ironed out most issues with workflow
and the video file corruption problem is solved

* distjob: wip proven to work on jenkins + kubernetes
one thing pending is video for distributed mode

* distjob: improvements, video embed

* fix bad bugs in job / exec

* fix nasty bug with nested call with driver

* intro beforeStart and afterStop for driver config
greatly improved docker image stability - for now not starting socat for remote debug todo

* fix step out in debug server
docker now can start ffmpeg if needed for docker target

* improve / simplify fat-docker build

* always wait for browser / driver port even if not starting

* no report for empty features

* fixed debug npe for background steps

* screen recording for mobile automation
added startRecordingScreen and stopRecordingScreen API
implemented saveRecordingScreen with embed to html feature

* distjob: bullet-proofing and some testing

* improve timeline html tooltip

* debug: log message for hot reload implemented

* debug: improve user feedback

* debug: improve log for prev commit

* debug: try system exit for clean stop

* added appium api to readme doc

* review changes karatelabs#895

* distjob: lot of fixes and bulletproofing saving work

* update release process after 0.9.5.RC2

* adding back the simple jobserver test it is needed

* fixed bugs in debug server
any step failure resulted in no more steps working, fixed
variable string conversion failure would crash session

* fix for debug and maven class paths

* decided to do the right thing and change driver scripts() to scriptAll()
also introduced the especially useful in debug repl highlightAll()

* debug support should work for gradle now

* adding local docker demo runner

* driver is auto passed to called features
and does not matter if shared or isolated scope
here we have a bending of the rules, a driver is always global

* lower-case-headers applies only to keys not values

* one line change makes jdk12 compile work for 8 runtime

* attempt windows fix for paths with spaces

* attempt fix for windows single feature debug session

* introducing scriptAll() that takes 3rd filter-predicate arg

* renamed findAll() to locateAll() and intro locate()

* added 3rd delay arg to driver input api

* for sake of debugger, driver element to be stringify-able

* classpath from jar was not working in some cases

* minor doc updates before rc3

* big change: we have killed the karate ui
this means everything builds on openjdk 8-12 and no more build and ci problems for developers
the karate-ui is not needed anymore because we have the visual studio code extension for debugging
and we really tried to use javafx but there were too many issues

* doc updates since we killed the karate-ui

* changes for karatelabs#903

* doc updates

* one more doc tweak

* ci can be normal openjdk now

* ci mvn cache, and goodbye karate-ui

* some doc edits, and to test ci

* improve contributor guides

* wip: working on distributed gatling support
and realized we need a stand-alone gatling example just like we have jobserver
so decided to finally open an examples folder that will hold multiple examples of which
we have a few already, so they can now live in the karate monorepo

* readme edits

* distributed job server working for gatling, todo test docker

* job executor now will ping server with a heartbeat every 15 seconds
this is great to ensure all remote ends are healthy, in the future this will allow us to do the following
a) slurp logs from remote executors as long running test is progressing, think gatling - so we can generate reports any-time
b) abort a test - when the next heartbeat comes in we can respond with a special case abort message
the heartbeat has to use a second http client else severe concurrecy issues happen
so this second thread can now throw an exception which will cause the main executor loop to shutdown

* ignore examples jar files

* add hot reload functionnality for mock server

* multipart/form-data endpoint success from REST client but fails in Karate tests karatelabs#797

* minor edit for driver.title readme

* make sure docker container has deps pre-loaded for gatling
improve logs for job server (more at info level) to give confidence that things are happening etc

* rebrand to karate ui, and added link to readme

* change file change handler to use Jave Watchservice instead of a sleep loop

* implemented local address support for gatling
refer https://stackoverflow.com/a/55458266/143475

* added missing highlight() to element / finder api
also added friendly locator find() option to also use visible text, not just tag name

* code cleanup after karatelabs#909

* set type so that it does not create work dir with name null

* HACKTOBERFEST-match != fails with two integers

* fire change event for js based select-box twiddling

* added retry chained to finder / element

* doc edits

* MockSpringMvcServlet issue for @ControllerAdvice NoHandlerFoundException

* code cleanup after karatelabs#931

* Update consumer-driven-contracts to spring boot 2

Update consumer-driven-contracts to spring boot 2

* making correction to karatelabs#932

* update supervisord command to be the correct path for google-chrome

* Update Chrome.java

* Update Chrome.java

* Update Chrome.java

* fix gatling value copy edge case ref karatelabs#936

* minor code cleanup

* Fix formatting in pages site

* Fix formatting in pages site

* escape intellij magic log strings karatelabs#954

* escape intellij magic log strings karatelabs#954

* gatling url pattern bug
pretty bad miss that causes tests that use the comma-delimited path keyword to lose the forward-slashes
so a url like http://foo/bar/baz would become http://foo/barbaz

* release tweaks for 0.9.5.RC4

* edge case syntax error should not hang tests #959

* safer impl for #959

* finally, solution for custom masking of http headers / payloads in logs karatelabs#699
also attempted along with this is more control over [report verbosity] possible from the execution-hook

* doc edits minor

* http log masking for jersey also karatelabs#699

* fix for karatelabs#970 and replace karatelabs#973

* some doc / typo edits

* dynamic scenario outline pre-scenario vars deep-copy was losing js functions karatelabs#982

* error handling for karatelabs#967

* updating docs

* dont auto-close driver in called scenarios karatelabs#969

* implemented tags support in karate-gatling karatelabs#968

* attempt to fix karatelabs#924 but doesnt seem to work

* updated docs to use Runner.path() builder API
and not the KarateOptions annotation for parallel test execution

* edit release process cheatsheet

* edge case for regex combined with array fuzzy karatelabs#988

* junit 5 should fail if no features found karatelabs#989
also decided to rename the static method / helper to run()

* update doc for karatelabs#989

* edit readme for examples/jobserver

* add getPrevResponse() to scenario-context for advanced hook use-cases

* better xpath for wildcard with index karatelabs#993

* of all the times you commit without testing karatelabs#993

* doc edits and archetype sync for junit 5

* multipart streams will be re-readable for retry until karatelabs#999

* [break] implemented configure abortedStepsShouldPass karatelabs#755

* implemented driver poll for port configurable karatelabs#990

* implemented mock headerContains() karatelabs#997

* improve code for karatelabs#755

* Add support for optional body in Postman convert

Also adding whitespace to the Postman converted output.

* log collection for dynamic scenario outline karatelabs#1003

* input stream special handling in json embedded expressions karatelabs#1009

* doc edits and import cleanups

* Add logic for Postman import on netty CLI

* Include tests

* fix build after karatelabs#1011

* wip - introducing [karate-robot]
karate-robot is an attempt to build the following cross-platform capabilities into karate
a) native mouse events b) native keyboard events c) desktop image capture d) image matching
we have the basics in place for mac, linux and windows
decided to use the javacpp presets for opencv https://github.com/bytedeco/javacpp-presets/tree/master/opencv
also the [karate-chrome] docker image has been revamped - now includes an x-windows manager (fluxbox)
and is compatible with [karate-robot]
note that opencv on windows seems to be slow to startup / load the dll-s and may need investigation
otherwise we have the foundation in place to be able to use images to locate areas on the screen and navigate
todo: improve the robot api and add a configure option similar to karate driver (now branded as karate ui)
which will inject a [robot] object and helpers similar to how [driver] works today for karate ui

* [robot] keyword to init robot + config similar to [driver]
see feature file in commit for example

* [robot] working on image matching, introed region concept
and chainable api-s to find, click - also highlight() is working, very useful to troubleshoot image stuff
facing some challenges with more image matching, needs investigation
may need to deep dive into the opencv routine and look at other options, finding a set of matches instead of one
and also getting into thresholds, search types, image types (right now only grayscale) etc

* [robot] simple flow works
lesson learned - the way opencv image finding works currently requires the image to be the same size
we probably need a way to match even if scale is different, todo

* [robot] wip find by image even when scale is not 1:1
seems to be working and even came up with a threshold detection score based on trial and error
robot will now retry if image not found based on the threshold score calc
driver config now working to highlight match region if flag is true

* some places in docs / examples to use enhanced scenario outline

* support headless flag for firefox

* Update documentation

* Update documentation

* [robot] wip relaxing the image find threshold slightly

* synchronized getFreePort to avoid duplicate port assignments

* skip unnecessary window close on quit

* configure header / cookies now reflect in http-request-builder karatelabs#1025

* Always add 'alwaysMatch' block to capabilities

* make some readme section more clear

* improve readme

* fixed bugs in ui demo scripts

* cucumber tables will now appear in report json / html report karatelabs#1035

* Support acceptInsecureCerts in driver options

* Updated README with acceptInsecureCerts

* simplify w3c webdriver capabilties karatelabs#924
so the user can specify whatever is needed and we keep the karare side simple
this makes sense as there are so many options, eg saas / remote drivers

* improve upon prev commit karatelabs#924

* improve edit upon prev commit karatelabs#924

* update w3c capabilities handling karatelabs#924
also updated chrome-web-driver to be w3c compliant for latest chrome version
some new problems with safari, will defer

* always use w3c driver capabilities alwaysMatch  karatelabs#924

* update ui web examples

* upgrade apache httpclient version

* karate can now use a remote webdriver instance
added [webDriverUrl] key and some extra driver init logic and works fine against zalenium
breaking change for some of the wip appium work
see doc changes for all the details

* minor doc edits

* confirmed to work with aws device farm and selenium grid standalone
also changes to what was discussed in karatelabs#924
so now it is [webDriverSession] and not [webDriverCapabilities] so user has full control over the
webdriver POST to /session payload - which will take care of any remote / saas situation
and quirks of implementations like selenium grid
introduced [httpConfig] key and now you can configure the http client e.g. readTimeout which is
needed for aws as it can take a long time for a device / browser desktop to be provisioned
see readme edits for details

* fixed doc typo update

* refactored webdriver implementation
especially the start life-cycle, better error detection and handling on session fail
mobile / winappdriver breaking change for starting session, need to use [webDriverSession]

* fixed gaps in winappdriver demo

* improve stabilize ui infra
docker-target will pull only if flagged, and will remove container instance at end
added nice test to check docker container locally in demo/driver/core
chrome native will always wait for http to be ready

* ie driver wip

* iedriver tested and working fine

* added doc for iedriver

* more logical refactoring of ui driver packages

* added simple skeleton for testing / replicating karate ui issues

* null in dynamic scenario outline cell causes npe karatelabs#1045

* updated docs to point to external example

* fix link in prev commit

* fix link in prev commit 2

* ok last try for the readme tweak

* defensive coding for karatelabs#1047

* upgrade jersey version

* update docs

* [warn] karate.log() now pretty prints

* karate-robot ready for (experimental) release
now you can set a base-path from which images will be loaded
added readme to get things going

* prep doc for release wip

* update doc release wip

* doc edit wip

* prep release 0.9.5 final

* Bump netty.version from 4.1.37.Final to 4.1.50.Final in /karate-core

Bumps `netty.version` from 4.1.37.Final to 4.1.50.Final.

Updates `netty-handler` from 4.1.37.Final to 4.1.50.Final
- [Release notes](https://github.com/netty/netty/releases)
- [Commits](netty/netty@netty-4.1.37.Final...netty-4.1.50.Final)

Updates `netty-codec-http` from 4.1.37.Final to 4.1.50.Final
- [Release notes](https://github.com/netty/netty/releases)
- [Commits](netty/netty@netty-4.1.37.Final...netty-4.1.50.Final)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: Peter Thomas <peter_thomas@intuit.com>
Co-authored-by: Sharma Prashant <Prashant.Sharma@swisscom.com>
Co-authored-by: lukas.cardot <lukas.cardot@ekino.com>
Co-authored-by: Peter Thomas <ptrthomas@gmail.com>
Co-authored-by: babusekaran <sekaranbabu@ymail.com>
Co-authored-by: BenjamQC <benjamin.andriolo@gmail.com>
Co-authored-by: Nishant-Sehgal <nishuchd36@gmail.com>
Co-authored-by: tbhasin <tamanna_bhasin@intuit.com>
Co-authored-by: Manoj Y <manoj_yadav@intuit.com>
Co-authored-by: BadgerOps <github@badgerops.net>
Co-authored-by: srangaraj1 <sivachithambaram_rangaraj@intuit.com>
Co-authored-by: ghostwriternr <ghostwriternr@gmail.com>
Co-authored-by: Thomas <pthomas3@intul177117d7e.corp.intuit.net>
Co-authored-by: Celeo <celeodor@gmail.com>
Co-authored-by: paaco <info@paaco.nl>
Co-authored-by: alexanderp <alexanderpaalvast@zlm.nl>
Co-authored-by: paaco <paaco@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@DineshTejaj
Copy link

@paaco : When am trying to open firefox with the below
Could you try:

  • def session = { capabilities: { alwaysMatch: { browserName: 'firefox', proxy: { proxyType: 'manual', httpProxy: '127.0.0.1:8080' } } } }

Chrome browser it getting opened up, Please help me in launcing Firefox and edge drivers am good with chrome,

Please help me in opening Firefox and Edge browsers? please share the sample code here

cc: @ptrthomas

@DineshTejaj
Copy link

Getting the below error
14:35:02.571 [geckodriver_1654765502546] ERROR com.intuit.karate.shell.Command - command error: [geckodriver, --port=4444] - Cannot run program "geckodriver" (in directory "target\geckodriver_1654765502546"): CreateProcess error=2, The system cannot find the file specified
14:35:08.080 [main] ERROR com.intuit.karate - driver config / start failed: start failed, options: {type=geckodriver, webDriverSession={capabilities={alwaysMatch={moz:firefoxOptions={args=["-headless"]}}}}, target=null}
com.intuit.karate.KarateException: start failed

@ptrthomas
Copy link
Member Author

@DineshTejaj I haven't tried with firefox and edge at all, do investigate if you can

@DineshTejaj
Copy link

@ptrthomas : When am using this command

  • configure driver = { type: 'geckodriver', showDriverLog: true }
    AM getting the below error, [geckodriver_1654765502546] ERROR com.intuit.karate.shell.Command - command error: [geckodriver, --port=4444] - Cannot run program "geckodriver" (in directory "target\geckodriver_1654765502546"): CreateProcess error=2, The system cannot find the file specified
    14:35:08.080 [main] ERROR com.intuit.karate - driver config / start failed: start failed, options: {type=geckodriver, webDriverSession={capabilities={alwaysMatch={moz:firefoxOptions={args=["-headless"]}}}}, target=null}
    com.intuit.karate.KarateException: start failed

Karate is not supporting firefox?

@DineshTejaj
Copy link

Thank @paaco. I tried also before with Chrome but nothing, I'll retry with your suggestions with Firefox.

@forlixdev @paaco for me when am to launch firfox driver, the browser is not getting opened up, Can u please help me here, Can u please give me the feature on how to launch firefox browser

@ptrthomas
Copy link
Member Author

Karate is not supporting firefox?

to the best of my knowledge, yes ;)

@paaco
Copy link
Contributor

paaco commented Jun 9, 2022

@DineshTejaj Please make sure geckodriver(.exe) from https://github.com/mozilla/geckodriver/releases is in your path because it says literally:
"Cannot run program "geckodriver" (in directory "target\geckodriver_1654765502546"): CreateProcess error=2, The system cannot find the file specified"

Firefox requires a driver to be placed in between Karate and the browser. (maybe still Edge, not sure about the chromium Edge nowadays)

@DineshTejaj
Copy link

@paaco : I tried with the gekodriver.exe now the firefox is opening perfectly but on entering a text in a text box am getting an error, only if am using firefox, if I use same lines of code for chrome it is working , please help me if am missing something or I need to add any configs

code:
Scenario: to set the config and driver

Note: Browser is getting launched, url is getting navigated, the email id "abc@gmail.com" is also entered but after that getting below error please help

01: input("//*[@id='user[email]']","abc@gmail.com")
<<<<
org.graalvm.polyglot.PolyglotException: Expected to find an object with property ['message'] in path $['value'] but found 'null'. This is not a json object according to the JsonProvider: 'com.jayway.jsonpath.spi.json.JsonSmartJsonProvider'.

  • com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:71)
  • com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:81)
  • com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:79)
  • com.jayway.jsonpath.internal.path.RootPathToken.evaluate(RootPathToken.java:62)
  • com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:99)
  • com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:107)
  • com.jayway.jsonpath.JsonPath.read(JsonPath.java:185)

@ptrthomas please advice and help

@ptrthomas
Copy link
Member Author

I'm locking this thread. please continue the discussion on stack overflow where you have already opened an issue: https://stackoverflow.com/q/72564273/143475

we need the community to step up and contribute any gaps. I will also say that if this process if followed, the chances of the project team providing a fix increase: https://github.com/karatelabs/karate/tree/develop/examples/ui-test

@karatelabs karatelabs locked and limited conversation to collaborators Jun 9, 2022
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

4 participants