How to call sendEvent() from webdriver? - webdriver

We have a Python script which uses webdriver and PhantomJS to perform some tests. However, we'd like to send direct QT events using sendEvent() function (this is possible from both phantomJS scripting and casperJS).
I didn't find any docs for webdriver, though. How to perform such an action?
Thanks!

Related

How To Access Selenium Webdriver Through Splinter in Python

I'm currently using Splinter to build some web automation scripts and so far so good, but I've run into an issue where I can't actually fix it using the Splinter wrapper functions. But, I believe I might have found a solution that can be fixed using the Selenium Webdriver functions even though I'm primarily using Splinter.
I believe I've done this before years ago, but no matter where I've searched (Documentation, Google, Stackoverflow) I can't seem to find anything on this, so maybe it's not a feature anymore?
Anyways basically I need to access the Selenium Webdriver functions.
From memory, I believe the code was something like:
browser = splinter.browser("firefox")
brower.visit("google.com")
browser.webdriver.find_element_by_id('loginForm') #This is calling the selenium web driver direcetly, not the Splinter find_by_id function.
.webdriver
.driver
both do not seem to work.
Does anyone know how to correctly do this? Let me know if you need any more information. Thanks for your help.
The selenium is exposed by driver browser attribute:
>>> from splinter import Browser
b>>> b = Browser()
>>> b.driver
<selenium.webdriver.firefox.webdriver.WebDriver (session="e607ceaa-2c63-435e-9991-432376102bf5")>
>>>

Trying to get Protractor's location strategies in Node script (protractor.By)

I'm trying to setup protractor in a node script and I would like to get access to the location strategies. However, because I'm doing something stupid I am not seeing them on the protractor object:
var protractor = require('protractor');
//... Wrapping selenium driver
var by = protractor.By;
//console.log(by) returns '{}'
//and protractor.getInstance(); is returning undefined:
How might I get access to the selection strategies (by element, model etc). (I'm writing the script in this manner to work with CucumberJS, so, given the current setup I have I cannot simply run the protractor executable directly).
For anyone who cares to integrate Protractor and CucumberJS, the heuristic should be to execute protractor and have protractor execute cucumber, not the other way around.
My approach was completely wrong: Both protractor and CucumberJS are capable of integrating and executing the other's executable, however, using cucumberJS first would appear to be wrong. Rather I suggest using protractor to Drive the tests. Documentation for protractor integration with CucumberJS is extremely poor and difficult to find. Moreover there are a number of misleading pieces of information.
Right approach
See these example files in the protractor repo which, while not documented to my knowledge (or even acknowledged) provide what would appear to be an adequate means to integrate both tools. To execute it is necessary to have a protractor config setup appropriately
Wrong approach
Problems: Protractor Location strategies don't appear to work. protractor.getInstace() is undefined. protractor.By == {}
Following examples such as this, the implied setup in cucumberJS and similar examples with selenium results in protractor not fully initialising. The effect is that the location strategies appear undefined. There may well be a means to make it work, but after digging through the source-code for days I cannot find it easily.

Web Automation that can also run Unix Commands

Does anyone know of web automation software/app that also can run unix scripts? I know of the standard ones, but can't find out whether I can also run Unix scripts.
It's pretty common to multitask like that inside of Selenium WebDriver automation code.
For example, you could write a Selenium test in Python that also launches arbitrary external programs/scripts via Python's built-in support for executing commands.

How to use script/program(like java) to compile/run cobol by invoke the compile/run command of cobol?

We are using RDI (IBM Rational Developer for System i) to do cobol development work, we are eager to write automation test cases for our program, to make the testing work easier. But we don't know how to use script to compile and run cobol, which on i-series server.
For now, our solution is that we use scripts prepare test data (insert data to database/files),and then run cobol on RDI manually, finally, run scripts to check the results. It makes our work easier, but still not real automation test.
So, I want to know if there are some methods to invoke the compile&run process according to scripts, such eclipse headless or telnet technologies.
We've already found the solution: use telnet to compile/run program. Because green screen is one kind of telnet, it reliable.

Can I run Google's Native Client outside of the browser?

Is it possible to run Google NaCl outside of the browser as a process sandbox?
Yes. The standalone build of Native Client contains a program called "sel_ldr" which runs the NaCl sandbox outside of the web browser. A lot of NaCl's test suite tests NaCl by running programs under sel_ldr rather than under the browser.
The Native Client documentation is probably a good starting point for trying to figure out how everything works.
As Mark Seaborn and Bennet Yee indicate, you are probably best off looking into using sel_ldr. More details about how sel_ldr is included in "The life of sel_ldr".
I haven't personally implemented anything that uses NaCl outside of a browser, so I can't unfortunately comment on the ease of doing so.
To add to Mark's answer, take a look at the sel_universal target. There are obviously some interfaces that cannot be supported, e.g., Pepper interfaces, since such a stand-alone run doesn't involve a browser. Furthermore, the stable ABI that we support is that which is exposed by the "integrated runtime" or irt, and the irt code thunk assumes that the browser is present. a standalone use of NaCl via sel_ldr would probably have to use the syscall interface initially, until an alternate irt is written. (NB: we make no guarantees about the stability of the syscall interface.)
You can try run.py which included in Native Client's source.
Here is an example that runs a hello world program.
make test_hello_world_nexe
python native_client/run.py out/Debug/hello_world_newlib_x64.nexe
This script can build, search and invoke sel_ldr, and pass proper arguments to it automatically.

Resources