How to show POP UP window with message using Sikuli webdriver? - sikuli

I would like to show POP UP with message when my test runs successful. Pls suggest sikuli script for this.

As #autoKarma suggested, you can easily use the popup() function. I have been working with sikuli quite a while. You can see this simple code below.
popup("Display your message here")
That's it. This simple code would serve your purpose.
Goodluck

Have you tried using the popup() function? It is documented here. I don't know anything about sikuli's interaction with webdriver, so take it for whatever its worth.

variable = input("message", "default", "titleOfPopup")

Related

Selenium sendKeys with Chrome- Hebrew

I try to use:
action.sendKeys("some phrase with a dot, for example: www.google.co.il ");
but when i run the program what the action writes is:
www*google*co*il
the * represent hebrew character.
I can disable this only by disabling the hebrew language in my computer.
I tried to bypass the problem by using JS: set.attribute but it makes a lot of problems and i need something better.
Is there a function similar to sendkeys or a way to fix it?
You can try JavascriptExecuter using below code:
WebElement text= driver.findElement(By.name("q"));
JavascriptExecutor jsExecutor = (JavascriptExecutor) driver;
jsExecutor.executeScript("arguments[0].value='test input';", text);
Webelement is the textbox where your need to write the value.
Or you can try some copy paste action after clicking into text box.
actions.click();
Refer to this URL for help:
http://www.helloselenium.com/2015/03/how-to-set-string-to-clipboard-data.html
I found out a way to change language during the tests while I solved another problem related to Upload a picture. there is this freeware called AuTOIT that you can use to help you with dialogs on Windows. I wrote a script to push the alt and click shift and my language is changed.
To change the language, I use the line:
Runtime.getRuntime().exec("path_of_script_here/name_of_script_here.exe");
The script was made the following way:
Open a text file.
Inside the file write:
Send ("{ALTDOWN}") ;Hold down Alt
Sleep(100) ;Wait 100 milliseconds
Send("{LSHIFT}{ALTUP}") ;Press Left-Shift and release Alt
Save as .au3 file.
Download and install AUTOIT.
Compile the script and then exe file will be created.
Run the test.
Hope this will help everyone else who encounters this problem. If something is not clear, ask me and I will gladly help.

HTML - What does data-remote="true" do?

I was just working on a project that was sending an extra request and it was because of data-remote="true". I've seen this line plenty of times before, but I guess I don't really know what it does. I tried Googling it but all that comes up are specific examples where data-remote isn't working for the question asker.
I just want to know what the purpose of data-remote="true"/"false" is to get a better understanding of it.
data-remote = "true" is used by the Ruby On Rails framework to submit the form/link/button as an ajax request. If you are interested here is the guide discussing how Ruby on Rails works with javascript: http://edgeguides.rubyonrails.org/working_with_javascript_in_rails.html
It is definitely not a standard thing.
Usually data-*** is a custom attribute used on application level. So check in sources of your scripts - it is used by some code.
I was told that data-remote="true" is an HTML version of JavaScript's preventDefault() method, in that it simply prevents the form from being submitted to the server.
Rails applications along with the jQuery gem generates the global listener:
$(document).on("click", "a[data-remote=true]", function(e){
e.preventDefault();
$.getScript($(this).href())
});
Feel free to correct me if I'm wrong :)

Call angular function from protractor

I'm new to Angular and Protractor.
I'm using protractor to test Angular pages.
I'm trying to test log-in procedure.
part of the html is:
< li data-ng-show="isLoggedIn()" >
I want to make sure that the credentials are correct by calling the 'isLoggedIn()' function.
the 'isLoggedIn()' function is in a controller named 'navControl'.
can I do it? How?
are there other suggestions to test log-in?
You should be testing your log in page (if you are using protractor) like a user - enter some text in your login form, then click the 'Log In' button! After this, inspect the page for whatever elements you are expecting to be visible after a user has logged in. You shouldn't really be directly calling your application functions - testing those falls under unit testing, not e2e testing for which Protractor is designed for :)
Thanks for helping.
The exact phrase I was looking for is this:
expect($('[data-ng-show="isLoggedIn()"]').isDisplayed()).toBeTruthy();

Watir-Webdriver : take screenshot upon error/exception/fail. How to?

I am new to Watir-Webdriver. I have written a function to take the screenshot and it works fine. My problem is I need to call the method, upon any error/exception or fail happening during my testcase execution. I have googled it and couldn't find anything related. I have tried rescue block but it doesn't work for me. Any help is appreciated.
Thanks,
Alex
Alister Scott has this about getting screenshots on WatirMelon when using cucumber:
After do |scenario|
if scenario.failed?
Dir::mkdir('screenshots') if not File.directory?('screenshots')
screenshot = "./screenshots/FAILED_#{scenario.name.gsub(' ','_').gsub(/[^0-9A-Za-z_]/, '')}.png"
Browser::BROWSER.driver.save_screenshot(screenshot)
embed screenshot, 'image/png'
end
end

Html from Silverlight (not out of browser)

I am trying to open HTML file from the local URI which I use as XML Editor, to edit xml data that come from Silverlight application, then close browser window and return back edited xml data to the Silverlight application.
I tried to use HtmlPage.Window.Navigate but I don't quit like it.
I have tried using a method from: http://weblogs.asp.net/dwahlin/archive/2010/05/10/integrating-html-into-silverlight-applications.aspx
but instanly got an exception "failed to invoke ShowJobPlanIFrame"
Is there any way to handle this task?
"Out of browser" mode doesn't fit.
Thanks.
===========================================================================
Update:
It worked out using IFrame overlay.
Button click invokes the following code in C#:
var scriptObject = (ScriptObject)HtmlPage.Window.GetProperty("ShowJobPlanIFrame");
scriptObject.InvokeSelf(url);
Where "ShowJobPlanIFrame" is as defined at:
http://weblogs.asp.net/dwahlin/archive/2010/05/10/integrating-html-into-silverlight-applications.aspx
This allowed me to pass data into XML editor and then get it back.
An error with JavaScript function invocation I told above, was my fault in JavaScript code itself.
A very similar scenario: https://stackoverflow.com/a/7919065/384316
Try using an iframe overlay, then you can load any HTML-like content.
There is an excellent explanation of how to do this here:
http://www.wintellect.com/cs/blogs/jlikness/archive/2010/09/19/hosting-html-in-silverlight-not-out-of-browser.aspx
It worked out using IFrame overlay.
Button click invokes the following code in C#:
var scriptObject = (ScriptObject)HtmlPage.Window.GetProperty("ShowJobPlanIFrame");
scriptObject.InvokeSelf(url);
Where "ShowJobPlanIFrame" is as defined at:
http://weblogs.asp.net/dwahlin/archive/2010/05/10/integrating-html-into-silverlight-applications.aspx
This allowed me to pass data into XML editor and then get it back.
An error with JavaScript function invocation I told above, was my fault in JavaScript code itself.
Did you try NavigationFramework of Silverlight? It's capability may support your needs in a more simple way than using multiple browser pages.