Sikuli integration with Selenium WebDriver - testing

Can anyone tell me how to work with multiple edit boxes using Sikuli integrated Selenium WebDriver.
For example, I have 2 edit boxes which are labeled as username and password. So I want to click on the 1st edit box, then enter values and again want to click on the 2nd edit box. The size of the two edit boxes are the same. So how sikuli integrated Selenium WebDriver will identify which edit box to click.

If you are referring to the SikuliWebDriver, then this link has an example on the usage http://code.google.com/p/sikuli-api/wiki/SikuliWebDriver.
I would rather prefer using the Sikuli Java API and create wrapper functions around the Sikuli functions like click, type etc. This API is in active development and has good support available.
http://doc.sikuli.org/faq/030-java-dev.html

You can use the offset functionality. ie, you do not only use an image of the text field, but use a region of the screen which identifies something related to the text fields.
You may select a large rectangle which includes a heading above both fields, then use offset x/y coordinates and move the little crosshair over the exact location you wish to click/type.

Related

extracting html element Id or xpath using computer vision

I am working on automating an inhouse automation testing software for my firm, I need to extract the X-path, or id of an HTML element when the tester clicks the webpage element like the login button during the manual testing process, need to extract data like element id or x-path, and what type of action he is performing like click, enter or filling the text box, etc. these data would be useful for integrating with my existing selenium script and perform automation testing, currently exploring feasibilities of computer vision. Kindly suggest some ideas to make it possible.
-I think you need to extract and read HTML of the page separately then perform any concept/Algorithm of computer vision to detect all elements of the page including text , buttons and drop down list....

Get display coordinates of tab using chromedriver and selenium

I am looking to find the co-ordinates to a specific tab in a chromedriver instance controlled by selenium.
The scenario is as follows: I have a chromedriver instance automated with selenium that contains multiple tabs. I am looking to pin specific tabs (not all of them) and in order to do that, I am using autoit to send the necessary mouse and keyboard commands to pin the actual tab. However, in order to do that, I need to know the screen/display coordinates of the tab (so I can send the mouse there).
The chromedriver has the coordinates to the actual browser, however I have been unable to find any reference to the coordinates of the tab.
Does anyone know how I could go about getting the coordinates of a specific tab?
Update: I am using c#
It would be a big help if you let me know what language you are coding the tests in, however this can be achieved through checking the position of your scrollbar as the AI does not have a monitor to be limited to a resolution, essentially it can see the whole of the web-page no matter what.
Below is a link to some of the usage for checking and comparing the scrolled status, even if this isn't a direct solution i'm positive it will point you in the right direction. (This is something i had to do not very long ago)
http://www.software-testing-tutorials-automation.com/2015/02/how-to-verify-scroll-present-on-browser.html
If you have any queries let me know,
All the best, Jack

Selenium IDE click and drag

I am using the Selenium IDE extension for testing webpages in FireFox and I was able to find out how to perform almost every command that I need to automate testing for my webpage.
Unfortunately I was not able to find out how to do this through the list of commands that you can manually enter into the queue of Selenium IDE.
I was wondering if anyone knew how to do this in the Firefox extension. Thanks!
You can use dragAndDropToObject command which locates the target element and drags it to the centre of the destination element.
dragAndDropToObject
target: locator of the element to drag
value: locator of the destination element
There is also a dragAndDrop command which drags the element by specified amount of pixels and drop it.
For one thing, you might want to use Selenium Builder instead of Selenium IDE. Also, there are some things that Builder or IDE cannot record, such as iFrame interactions, certain AJAX actions, and also drag and drops. For those, you need to code them by hand afterwards and get them working.

How to enter text into user name when user name text field is on different frame using Webdirver

I have to login to application. But username and password text boxes available on different frame on the UI.
When i record using the IDE and exported into JAVA then same code is not working.
I am getting an error saying element is not present. This because the text box is on additional frame on the UI.
Kindly let me how to get the control of this frame and then enter the text.
Thanks,
Md Ashfaq
are you recording via ide on firefox and then running your tests on some other browser?coz sometimes diff browsers interpret it differently[I have faced issues where same webpage had iframes in firefox but not in IE].kindly check on that front.
Use The API capability to SwitchToFrame() then Look for element and interact with.
Note: You'll have to switch to any frame needed i find it efficient doing a selectDefaultFrame, try Iterating within Available frames and get handle/frame names

Selenium Webdriver 2.30 unable to identify object on the standard Salesforce lookup pop-up window

I am using Selenium Webdriver to automate functional TC in Salesforce application.
Test Scenario:
- On a case page, clicking the "Lookup" i.e., search icon opens up standard Salesforce search popup. I need to input specific string to the search field and click "Go" button.
Although I am able to click on the Search button, the script fails to identify any field on the popup.
I used Alert(), getWindowHandle & iterator functions to verify if the driver is working on the popup window. Yes it is.. the popup is is the working window. I could able to confirm this using the Java id for the browser window. But still it fails to identify any fields.
Let me know if any of you faces similar issue and any solution.
Do let me know if you like to have access to my working sandbox. Would be able to manage it.
Thanks, Manju
I believe the problem is that the elements inside the popup window are in a frame. After switching to the new popup window you need to switch to the frame first before being able to access any of those elements using:
WebElement frameLocator = driver.findElement(By.id("searchFrame"));
driver.switchTo.frame(frameLocator);
Further to Bob's answer you'll also then need to switch to the "resultsFrame" in order to use any of the links returned by the search. Note that in order to switch to a sibling frame you must first go up to the parent of the frameset using:
driver.switchTo().defaultContent();
(frameset guidance here: http://darrellgrainger.blogspot.co.uk/2012/04/frames-and-webdriver.html)
With Selenium IDE:
I was able to select the Salesforce PopUP with this code:
Command:selectPopUp
Target:
Value: Your popUp title
And the result frame:
Command:selectFrame
Target: name=resultFrame
Value: