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

switch-window with PhantomJS #146

Closed
ilevd opened this issue May 8, 2018 · 2 comments
Closed

switch-window with PhantomJS #146

ilevd opened this issue May 8, 2018 · 2 comments
Assignees

Comments

@ilevd
Copy link

ilevd commented May 8, 2018

The following code

  (let [d (phantom)
        prev-handles (get-window-handles d)
        _ (js-execute d "window.open(\"\")")
        new-handles (get-window-handles d)
        new-handle (first (clojure.set/difference (set new-handles) (set prev-handles)))]
    (switch-window d new-handle) ; exception here
    (quit d))

raises the exception:

ExceptionInfo throw+: {:response "Missing Command Parameter - {\"headers\":{\"Connection\":\"close\",\"Content-Length\":\"49\",\"Host\":\"127.0.0.1:2780\",\"User-Agent\":\"Apache-HttpClient/4.5.2 (Java/1.8.0_171)\",\"accept\":\"application/json\",\"accept-encoding\":\"gzip, deflate\",\"content-type\":\"application/json\"},\"httpVersion\":\"1.1\",\"method\":\"POST\",\"post\":\"{\\\"handle\\\":\\\"9cbb7e10-5273-11e8-840d-258ab46a6132\\\"}\",\"url\":\"/window\",\"urlParsed\":{\"anchor\":\"\",\"query\":\"\",\"file\":\"window\",\"directory\":\"/\",\"path\":\"/window\",\"relative\":\"/window\",\"port\":\"\",\"host\":\"\",\"password\":\"\",\"user\":\"\",\"userInfo\":\"\",\"authority\":\"\",\"protocol\":\"\",\"source\":\"/window\",\"queryKey\":{},\"chunks\":[\"window\"]},\"urlOriginal\":\"/session/9cb71140-5273-11e8-840d-258ab46a6132/window\"}", :path "session/9cb71140-5273-11e8-840d-258ab46a6132/window", :payload {:handle "9cbb7e10-5273-11e8-840d-258ab46a6132"}, :method :post, :type :etaoin/http-error, :port 2780, :host "127.0.0.1", :status 400, :driver {:args ("phantomjs" "--webdriver" 2780), :capabilities {:loggingPrefs {:browser "ALL"}}, :process #object[java.lang.UNIXProcess 0x26d26a0c "java.lang.UNIXProcess@26d26a0c"], :locator "xpath", :type :phantom, :env nil, :port 2780, :host "127.0.0.1", :url "http://127.0.0.1:2780", :session "9cb71140-5273-11e8-840d-258ab46a6132"}}  slingshot.support/stack-trace (support.clj:201)

With firefox and chrome it works, also it works with PhantomJS using Selenium (.window (.switchTo d) new-handle)

@igrishaev
Copy link
Collaborator

Well, as PhantomJS in deprecated now, its priorety is quite low in our work. Although if you're saying it works in Selenimun, it worths fixing it.

@Uunnamed
Copy link
Contributor

Uunnamed commented Aug 6, 2020

@ilevd thanks, fixed.

@Uunnamed Uunnamed closed this as completed Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants