I'm currently trying to open, manipulate, and close a "new" browser window(by "new" I mean there's already a existing browser window) in a single google chrome session in WebUnit` Package, Theoretically it's possible but I really don't know how to directly interact with Google Chrome driver.

Can anyone help? Thanks!

  • $\begingroup$ I'm not quite sure whether this is a valid question for this site cause it may need the package creator's help, but fortunately the creator @Arnoud Buzing is on this site :) $\endgroup$
    – Wjx
    Commented Jun 11, 2017 at 9:47

1 Answer 1


Simple example (note the package installs and executes it's own copies of chromedriver) https://github.com/arnoudbuzing?tab=repositories :

 pagePNG = CaptureWebPage[]
 pageHTML = 
  "return document.getElementsByTagName('html')[0].innerHTML;"];
 StringTake[pageHTML, 50]
  • $\begingroup$ Oh, sorry I didn't express myself clear enough, but I mean open a new tab on the same browser, e.g. Open another tab Google.com after MSE, in the final state, there shall be two tabs opening on the same browser. $\endgroup$
    – Wjx
    Commented Jun 12, 2017 at 0:46
  • 1
    $\begingroup$ I think you can use javascript to open a new tab, see url below. However, I don't think you can get around the creation of a new chrome instance when you start chromedrive, that appears to be the way it works. Makes sense as it need top down control. You can still interact with this instance of chrome in parallel to commands sent from chromedriver. Good hunting. stackoverflow.com/questions/15818892/… $\endgroup$
    – Dave
    Commented Jun 13, 2017 at 22:11
  • $\begingroup$ A new chrome instance could be created by evaluating StartWebSession[] again I suppose? $\endgroup$
    – Wjx
    Commented Jun 14, 2017 at 2:45
  • 1
    $\begingroup$ Your suggestion really helped! It leads me to a correct path~ JavascriptExecute[ "window.open('" <>html<> "', '_blank', 'toolbar=yes, location=yes, status=yes, menubar=yes, \ scrollbars=yes');"] works! $\endgroup$
    – Wjx
    Commented Jun 14, 2017 at 3:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.