-
Notifications
You must be signed in to change notification settings - Fork 105
The ability to send keystrokes to the browser. #61
Comments
Hi @rburton, There are a few ways to do this:
keystrokes := map[string][]string{"value": {"some keystrokes"}}
page.Session().Send("POST", "keys", keystrokes, nil) Let me know if the third case is what you're looking for. It should eventually be exposed with Hope this helps! |
The latter is exactly what I was looking to do. In fact, I created a function called SendKeys that does exactly what you just provided. One other request is around the ability to wait for elements to be visible. I noticed there's a recommendation in using http://onsi.github.io/gomega/#making-asynchronous-assertions but what I'm actually looking for is more on the lines to pause the execution until either a timeout period is reached or the element is displayed. In Java using RemoteWebDriver they have WebDriverWait and you would do something like wait.until(presenceOfAllElementsLocatedBy(cssSelector("#name"))); One more last question :) It would be very powerful to obtain the PID of the PhantomJS process that's running so users could check to see how much memory the process is using. Overtime, Phantom.js tends to grow in memory usage, so it would be awesome to check the memory size and restart the process if it starts to exceed a certain amount of memory. Keep up the great work. |
Done (6bebd20). I've seen most people use the If you want to wait for an element to become visible on the page with a provided timeout, use the Agouti import (
...
. "github.com/sclevine/agouti/matchers"
. "github.com/onsi/gomega"
...
)
...
Eventually(page.Find("#my_element"), "100s").Should(BeVisible()) If you only care about DOM presence: Eventually(page.Find("#my_element"), "100s").Should(BeFound()) Exposing the PID of the Thanks! |
I'll take the information you provided and work on a push request. In addition, I'm going to work on a way to pass cli options to Phantom.js so a user can avoid loading imagines for instance. |
Just a quick note that we also use the
|
Is there a way to send chords, or a keydown/keyup? For example I want to send
|
I was looking to see if the API has the ability to send keystrokes, but I was unable to locate it. Is this possible?
Sorry, I couldn't find any documentation and I've been reading through the code and API trying to locate this. It seems like I would have to implement this via the agouti.Session and the JSON protocol.
The text was updated successfully, but these errors were encountered: