3 searchbox with 3 question marks, Sikuli Fails to click 2nd element - selenium

I have 3 search box field and 3 question marks near by each search box. If I try to click on the 2nd question mark, It always clicks the 2nd Search box instead of clicking the question mark button. [Sikuli not clicking the exact element]1 Kindly have a look into the below image i have attached. Click "1" to view the image... Pls dont come up with coordinates. I shouldn't use coordinates in my project.

Well, this may not be the fully qualified answer, which do not use Region, Co-ordinates & autoIT as you are expecting.
This is code in Sikuli which uses findAll() method.
I created a dummy window as per your screenshot as below:
Edit
public void clickButton() throws AWTException, FindFailed
{
m_sikscr=new SikuliScript();
m_screen=new Screen();
m_sikscr.switchApp("Java Swing Examples");
m_screen.wait((double)3.0);
int i=0;
Match[] array=new Match[5];
Iterator<Match> rs1 = m_screen.findAll(new Pattern("./img/Button1.png"));
while(rs1.hasNext())
{
array[i]=rs1.next();
i++;
}
m_screen.click(array[1]);
}
This clicks only the second button on screen.
Hope this much triggers the thought of making it work completely.

Related

Search Text in PDFViewWPF

I'm using PDFNet to display PDF-files in my WPF application.
I need to provide a search mode where one can enter a search term which will be searched in the whole PDF-file. I found FindText in the documentation, but it doesn't seem to work properly. If I'm going to execute the method I can see a thread ending in my console output in Visual Studio - so it seems to run.
If I'm going to click the button multiple times the view will be scrolled to the corresponding find results but sometimes (or mainly) the text will not be selected.
The method which will be executed looks like the following:
private void Toolbar_DocumentSearch_Click(System.Object sender, System.Windows.RoutedEventArgs e) {
if (this.TbSearchTerm.Text.Length > 0) {
_pdfview.FindText(this.TbSearchTerm.Text, false, false, false, false);
}
}
Any hint on what I'm doing wrong?
Additional information:
If I've searching through the whole document, it starts from the beginning. Then the first find result will be selected but none other until the next find result is on the next page.
The built it in text search in PDFViewWPF is the type of search you get when you typically select ctrl-f when viewing.
PDFViewWPF.FindText does search the entire document, but does not display all the results in a window or control
You can add your own full text search control using the TextSearch class.
https://www.pdftron.com/pdfnet/samplecode/TextSearchTest.cs.html

Tosca: How to scan Dropdown textbox which disapper upon opening xScan

I have a problem in scanning a drop-down menu which disappears upon opening the xScan. I need to get the module id of the dropdown menu to verify some test steps.
Do you have any solution with this if it is not really possible to get the module id of the dropdown menu?
Open developer tools in your browser of choice (F12), navigate to the console and input the following code:
var fulldoc='';
var scrollX=0;
var scrollY=0;
document.addEventListener("keydown",function(event){
if(event.key=='q' && event.altKey){
fulldoc=document.body.outerHTML;
scrollY=window.pageYOffset;
scrollX=window.pageXOffset;
}
if(event.key=='w' && event.altKey){
document.body.outerHTML=fulldoc;
document.body.scrollTo(scrollX,scrollY);
}
});
When the window looks the way you would want to scan, press 'Alt + Q', then press 'Alt + W'.
Now your window will freeze and then you can scan your page.
To steer the objects you need to refresh your browser.
You can resolve the issue with below 2 steps
1 - Add some text in textbox which will populate the dropdown below it .
2 - Use Send Keys Module to scroll down and select the value.
I had a similar issue where we had a popup that only appeared when clicking on a text box. The solution we received from the Tricentis trainer was as follows:
Part One
1. Open your application in Chrome
2. Right click the inspect
3. In the inspector window, on the Elements tab, navigate to your html element where it should be (you can do that by clicking on the element and check that you can see the html in the element)
4. Use the debugger to add a break point there, this should pause it and you should be able to see the elements you need to steer it.
5. Once you found the element, you will need the type of element (e.g. div, span, etc), and the class name
Part two
1. Rescan your module and select any element that matches the criteria of your element selected in Part One #5
2. Identify it by only it's class name property and tag
3. Save and close
4. Edit the element in the module view by changing the class name. This should help you steer it
Note: if the element class name is not unique, you might need to use Explicit name.
Good luck

How to select value from Google auto location using Selenium

How to automate this to select particular value even the dropdown list id cannot be inspected. Can anyone help me out on this?
Need to select U.S. 22 Imperial from the list
Please find the HTML snippet
I am unable to proceed more than this. Please help me out!
WebElement location = driver.findElement(By.id("selectbox-city-list2"));
location.sendKeys("us");
You could use sendKeys and send arrow down to select an option. Selecting one by one with the arrow down will highlight the value. You will be able to check the highlighted value using the CSS class of highlighting.
You can use ActionClass
using this you can move your cursor over a specific element based on coordinates and perform a click.
1.So taking the coordinates of that text box.
2.Enter the full value in the text box. ,
3.calculate a very near coordinate to that text box(so that it will be the suggestion) and perform a click.
element = xxxxxxx;
Actions builder = new Actions(driver);
builder.moveToElement(element, x_coord, y_coord).click().build.perform();

Window object recognition using RFT on Print Dialogue

Why is RFT not recognizing the objects I have on a windows Print dialog.Included are few screen shots.
I am able to get the correct activeWIndow by
TestObject[] to ;
IWindow activeWindow = RationalTestScript.getScreen().getActiveWindow();
System.out.println("Class of active window is "+activeWindow.getCLass()): // returns #32770
ScreenTestObject root = RootTestObject.getScreenTestObject();
to = root.find(atLIst(atDescendant(".class", false),atChild(".class", ".Pushbutton", ".text", "Print"))) ;
Apparantly I can't post pictures. here is the link for print window and print button properties screenshot
http://www.flickr.com/photos/24358027#N07/12977082214/in/set-72157641973533994
...resolutions is horrible, I can type all the information if anyone needs it. Sorry and Thanks in advance.
Try The below Code snippet. I tried launching the print dialog from notepad and ran below script to find the print button and click it.Hope it helps.
//Find the Print button
TestObject[] to = find(atDescendant(".class",".Pushbutton",".text","Print"),true);
System.out.println(to.length);
//If you are sure you have just one print button on screen.
if(to.length==1)
((GuiTestObject) to[0]).click();
//Else traverse through the found object and compare the properties of the button you want to click
Update : I did a workaround for this, using tab to navigate. Once Tab is on the button, I input Enter. So it's not a work stoppage issue anymore, but I do need to figure out the right way to do it.
Thanks

Work with second opened broser

I am new to selenium i have a problem with.
I am working with one form at that when I click the "Report" it
launches the new browser with some data. I want to work with data.
How to get that data and verify that data
Launching and opened browsers are Fire fox browser
Please share your experience.
Assuming this is Java you are talking about - using the getting started with selenium framework.. your test would look like this.
#Config(url="http://mysite.com", browser=Browsers.FIREFOX)
public class MyTest extends AutomationTest {
#Test
public void myTest() {
click(By.linkText("Report"))
.waitForWindow("The Report") // specify what title or url the window is to be
.click(By.linkText("something in the new window"))
.validatePresent(By.cssSelector("div#content")); // validate whatever you need.
}
}
If you are choosing to not use a framework, then you will have to use the WebDriver#switchTo()#window() method to switch to the window.
Also, disambiguate selenium-rc and selenium2. They are both completely different software packages.
This is with related to selenium rc
Consider the case where I have 2 forms or window:
Currently I am at 1st form where Report button is present when I click the button it opens another form or window.
Below code is to select the 2nd form or window and maximizing it...
Please give the title of the window..(in my exmaple i have title of 2nd form as 'Terms & Conditions | Photojaanic').
selenium.selectWindow("title=Terms & Conditions | Photojaanic");
selenium.windowFocus();
selenium.windowMaximize();
Below code is to return to original form where Report button is present.
selenium.selectWindow("null");
selenium.windowFocus();