Error using "Click In" Keyword - Robot Framework with Sikuli Lib - testing

I have the following problem using Robot Framework with Sikuli Lib:
When using the keyword "Click In" I get an error.
I don't know what it could be.
Could they help?
Error:
org.sikuli.script.SikuliXception: image to search (22, 23) is larger than image to search in (310, 18)
Test
Click In image_full.png icon_from_image.png
Can anybody help me?
The objective is, through an image of a region, to click on an icon from another image (icon, which exists in the image of the region)
Thanks!!!

Error says your reference image is bigger than where the you want to look for it to be present. Eg. Your reference pic is 23pixels ans app is only 18. How about trying to remove the extra 4 pixels ?

Related

I don't understand how to make this error go away; Cannot resolve Symbol 'ImageViewer' and i have already imported facebook.fresco and github.stfalcon

enter image description here
enter image description here
I have tried implementing some libraries images above, and the suggestion that shows says create inner Buider but that is not working out pls someone help me

How to create a better screenshot during the selenium automation in JAVA?

I am creating automated test cases by using selenium 3 & testng. Everything looks good, except the screenshots that are generated. Here is my piece of code to create screenshots PNG files:
file = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(file, new File(pngfile));
which is pretty standard way to do it, but the quality of the created PNG file is not so good.
As you can see from following PNG file. In the picture, the email value ( "....#yahoo.com"), which should be at the upper-right corner of the web-page and should be as high as the other navigation bar elements on the left side. But in the created PNG file, this item has been squeezed to the lower level, which is not what I am looking for. Any ideas ? Thanks for the help !
Make sure your window is the right size when you're opening the browser. You can do this via visual inspection or using Selenium's getSize method. I assume you're using Java, but here it is in Python as well.
Then, if the window is not of the correct size in order to guarantee that your webpage's CSS doesn't break, use setSize. Here is that method in Python as well.
Afterwards, your screenshot should look like the window does.
Please try this,
public void calltakeScreenShot(String SSName) throws Exception
{
File screen = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
BufferedImage img = ImageIO.read(screen);
File filetest = Paths.get(".").toAbsolutePath().normalize().toFile();
ImageIO.write(img, "png", new File(filetest + "\\Screenshots\\" + SSName + ".png"));
}
Additionally Here you just need to pre-created Screenshots folder in your Project directory. It will store it by getting absolute path of your project. Also you can manage screenshot name by passing argument.
After several day's research, here is my latest summary.
A). If I was executing the scripts, that is not in the "headless" mode. When the selenium test case is being executed, I will see a new browser session is being popped up and get to that URL, click some buttons, etc, ... till the execution is finished. In this execution, the screenshot page will be saved in good quality.
B). For the same selenium test script, if I am including one extra ChromeOptions setting, which is "--headless", I will not see any browser being brought up during the execution. And once execution is finished, I will get the screenshot with such squeezed web elements.
Comments ?

org.openqa.selenium.WebDriverException: unknown error: cannot focus element on trying to upload a file in selenium

I am trying to upload a file in the webpage through selenium webdriver, and i have written the below code
driver.findElement(By.cssSelector("#collapseDocuments > div > button.button.ng-isolatescope")).sendKeys("C:\\Users\\siva.247588\\Desktop\\Clarient+AML+Questionnaire.docx");
The CSS selector is that of the browse button.
I am getting the below error whwn i run this:
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot focus element
What is wrong with my code? Could any one advise?
When you try to upload a file, the control is shifted to our local machine from website where we were writing scripts.
So normal click method and select method won't work. You can use robot method to browse and upload some file from your local machine to websites.
Hope this help you..
See the below link for help:
http://www.seleniumeasy.com/selenium-tutorials/webdriver-file-upload-using-robots
I've used this somewhere , hope you can relate this:
Robot rb = new Robot();
rb.keyPress(KeyEvent.VK_A);
rb.keyRelease(KeyEvent.VK_A);
rb.keyPress(KeyEvent.VK_L);
rb.keyRelease(KeyEvent.VK_L);
rb.keyPress(KeyEvent.VK_E);
rb.keyRelease(KeyEvent.VK_E);
rb.keyPress(KeyEvent.VK_R);
rb.keyRelease(KeyEvent.VK_R);
rb.keyPress(KeyEvent.VK_T);
rb.keyRelease(KeyEvent.VK_T);
Thread.sleep(4000L);
rb.keyPress(KeyEvent.VK_TAB);
rb.keyRelease(KeyEvent.VK_TAB);
Thread.sleep(4000L);
rb.keyPress(KeyEvent.VK_ENTER);
rb.keyRelease(KeyEvent.VK_ENTER);
This will browse and upload a file with name "Alert"
If you need more help, kindly provide me code and what you want to upload , I'll help you to resolve your issue.
As #theroot mentioned AutoIT is a good solution, but the downside is it works only on windows based platforms. The best solution so far that I have come across for upload or focus outside browser situations is using Sikuli. Example code is below
Screen sikuliObject= new Screen(); // Creating Screen class object
Pattern add = new Pattern("path to the image.png"); // Path of the upload button image.
sikuliObject.click(add); // Click on Upload button
Thread.sleep(2000); // Wait for 2 seconds for upload window pop-up.
sikuliObject.type("Path of the uploading file and click on enter."+ Key.ENTER );
//Path of the uploading file and click on enter.
Thread.sleep(2000); // Wait for 2 seconds to load the file.
I've once had a similar problem (I'm not sure anymore if it threw a "not visible" exception or the "could not focus"one) and the problem was that the input Element wasn't accessible because it had no dimensions. I've changed the DOM information using the JavaScriptExecuter and afterwards it worked fine. Just go through your page with Firebug and look if the element is really visible.

when I load .off file in CGAL Polyhedron demo, nothing were showed in the window

enter image description here
I have build the demo succesfully, and runs the demo, but when I try to load .off file, it comes out nothing. In the console window, the error message " QWindowsNativeFieDialogBase::shellitem:SHCreateItemFromParsingName(file:debug)failed(no such file or direcory)"
Could somebody give me any instruction?
It seams the problem is similar to this one : [http://cgal-discuss.949826.n4.nabble.com/Problem-with-loading-off-files-in-Polyhedron-demo-td4661212.html][1]
Do you build any plugin ? You need at least off_plugin to load an off file in addition of Polyhedron_3

Xcode 5 invalid image path error

Im relatively new to programming and am just in the process of uploading my first app to the app store however i am getting the following error message which i just can't figure out / fix. I have looked everywhere online for a solution but as yet, no luck. Please can someone help? I am using Xcode 5:
Error:
ERROR ITMS-9000: "Invalid Image Path - No image found at the path referenced under key 'CFBundleIcons': 'AppIcon40x40'" at SoftwareAssets/SoftwareAsset (MZItmspSoftwareAssetPackage)
This really doesn't mean anything to me as i have tried all the usual asset catalogue stuff / looked at my p-list.
You need an App Icon.
If you created the project in Xcode 5 then there should be a catalogue called Images.xcassets where you should place the icons of the correct sizes for your app.
I have added a screenshot of my app as an example of what I am talking about:
I saw the same error. First I thought that the images where not correct (I found one with 144 dpi), but the error showed up again.
Just search for the exact name "AppIcon40x40" in the whole project using Shift+Cmd+F. I have seen it referenced in a plist file under another key. There you have to change the names to the appropriate ones.