How to using Selenium IDE with Fabric Js - selenium-ide

I need to test Selenium in my web-app using Fabric js but I don't have any solution for select object on fabric canvas by Selenium IDE.

This worked for me when run against http://fabricjs.com/freedrawing/
<tr>
<td>mouseDownAt</td>
<td>css=canvas.upper-canvas.</td>
<td>200,10</td>
</tr>
<tr>
<td>mouseMoveAt</td>
<td>css=canvas.upper-canvas.</td>
<td>300,100</td>
</tr>
I believe the coordinates are the coordinates within the element. So if you select the right locator, it should be relative to the canvas... if you're selecting the wrong locator (like the whole window frame), all bets are off

Related

How to diagnose failed validation of Word Add-In when it works on my own setup?

I'm developing an MS Word Add-In. I've tested it on both Windows and Mac, and it works fine for me. Microsoft requires its own validation of Add-Ins to make sure they work correctly, and my Add-In fails for them even though it works for me with the same version of Windows and Word.
I had a phone call with the Microsoft Validation team, and their only suggestion was that I post a question on Stack Overflow so here goes!
This is the version of Windows and Word that works for me but fails for the MS Validation team:
Windows 10 Pro OS build 18362.295
Word 2016 (Version 1908 in particular)
I submitted a very simple add-in to Microsoft for debugging purposes. This simple add-in has only a single button that just opens a web page in the user's default browser.
This is the relevant portion of the manifest:
<Control xsi:type="Button" id="PB.Home.Button">
<Label resid="PB.Home.Button.Label"/>
<Supertip>
<Title resid="PB.Home.Button.Title"/>
<Description resid="PB.Home.Button.Desc"/>
</Supertip>
<Icon> ... </Icon>
<Action xsi:type="ExecuteFunction">
<FunctionName>navigateToWebPage</FunctionName>
</Action>
</Control>
This is the entirety of FunctionFile.html:
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" ></script>
<script src="https://appsforoffice.microsoft.com/lib/1/hosted/Office.js" type="text/javascript"></script>
<script src="FunctionFile.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
This is the entirety of FunctionFile.js:
(function () {
Office.initialize = function (reason) {};
})();
function navigateToWebPage(event) {
window.open('https://www.example.com', '_blank');
event.completed();
}
On my computer, when the button is clicked, a browser tab is opened with the web page, but for the MS Validation team this message appears in the toolbar at the bottom of the Word window
but nothing else happens.
The message "Patent Bots GCP is working on your Examiner Statistics" is generated by Word and not by my add in. "Patent Bots GCP" is the name of the add in and "Examiner Statistics" is the button label (one of the short strings in the manifest).
Any suggestions for how I can find out what is failing for the Microsoft Validation team? They are not able to provide any details about the error other than what I've included here.
I hope a Microsoft engineer sees this and is able to help.
=====
Maybe it is a popup blocker issue? See this: https://www.tek-tips.com/viewthread.cfm?qid=949178
Following up on Ragavan's comment, I did some searching for unexpected behavior of window.open() on IE11 (IE11 is the browser used in MS Word on Windows 10).
I found this other SO question, that noted
In IE on Windows 10 with default settings, if I perform a
window.open() against an external internet site from a page on my
local machine or a server on my local network, I get null.
that question further noted that
Interestingly, if I turn on "Enable Protected Mode" for the Intranet
Zone (so that Protected Mode are the same in the Intranet Zone and
Internet Zone), then the problem goes away.
I suspect this explains why my add in works on my Windows 10 computer, but not on the validation team's Windows 10 VM.
Unfortunately, the solution proposed in the answer there (w = window.open('') followed by w.location = url) does not work in the Word add in.
While this doesn't fix my problem, hopefully it leads the way to a solution...
#gaefan. Just adding my answer too if any one will have the same problem in future.
If anyone trying to open the external site from their add-in using JS window.open will end up in Object Expected aka validation failure error definitely by Microsoft. It depends on various factors like Windows 10 Build version, Office version and the Browser used by Add-ins.
So to publish your add-in successfully in the App source:
Note: This method is a workaround . But in near future If the new edge chromium version is released. Browser used by Add-ins will be changed. Then the workaround can be eliminated.
Use Task Pane add-in approach if your want to open any external site from Add-in.
The reason for recommonding Task-pane add-in is you can make utilize the anchor tag in your HTML like below
<a
href="https://yourcompany.com/"
class="button-config"
target="_blank"
(click)="performOperation()"
>Sign up
</a>
The reason for click event is to trigger any analytics function or trigger logs or add your custom logic
This will definitely open the external site without changing any settings on your browser.
If you want to stick on with command based add-in try adding new Action or Control button to open a external site via anchor tag.
Hope it will help some one. Thanks

Netbeans (7.0) HTML 'dynamic' code templates

I know how to define static, standard code templates in NetBeans and I am wondering whether it's possible to define more customized and dynamic templates.
For example, when i type div.className to generate me a HTML <div> element with the class I specify.
Start netbeans and go-to: Tools->Plugins menu,Available Plugins tab, then search for Zen Coding hit install.
type: div.className and hit: ctrl+alt+n to get: <div class="className">
You will notice the new Edit->Zen Coding menu.
Installation & usage: https://github.com/lorenzos/ZenCodingNetBeansPlugin#readme
Read more about Zen Coding at: http://code.google.com/p/zen-coding/

IE does not recognize my script

hello friends I have a big problem with internet explorer, I made a date validation using "select" with jquery, in Mozilla and crome works, but IE does nothing. Please I need help!
Your JS code calls for elements that aren't created in IE version less than 7 - thus it does nothing. See below:
<!--[if lt IE 7]>
<script type="text/javascript">
document.createElement("#date-star-month");
document.createElement("#date-star-year");
document.createElement("#date-finish-month");
document.createElement("#date-finish-year");
document.createElement("#date-star-month option");
document.createElement("#date-star-year option");
document.createElement("#date-finish-month option");
document.createElement("#date-finish-year option");
document.createElement("year_star");
document.createElement("year_finish");
</script>
<![endif]-->
This will not work in IE older than 7 - tested on 9, didn't work, until I ran IE9 in quasi-IE7 mode.
Additional pointers
Would be much easier to answer your question if you would be more specific.
Adding your code was a good move, do that from the start.
Too bad you didn't:
let us know what the validation function is supposed to do
on what browsers (with their versions) have you tested this
Also, if you state your intentions (why do you need that data validation, what it must do, etc.) you can get extra tips to achieve this in other (maybe better or easier) way.

Selenium beginner question

I am just trying to understand and learn selenium. I used IDE to record my actions and tried to playback but I am kind of stuck on the first step.
What I am trying is basically login to our internal site and then click on menu bar to navigate to an internal page. Selenium logs in but fails at the click event with error message -
[error] Element css=#ui-active-menuitem > span.wijmo-wijmenu-text > span.wijmo-wijmenu-text not found
This site is generated using primeface and when I see the source code, the line that generate error is something like-
<div align="left" class="container"><div id="menu"><ul id="menu_menu"><li><a href="javascript:void(0)">
<span class="wijmo-wijmenu-text">Home</span></a><ul><li>home</li></ul>
</li><li><span class="wijmo-wijmenu-text">Tills</span><ul>
<li>Manage........
I must tell here that as long as I am not clicking on above menu item, I am able to run all tests through Selenium ID but clicking on above menu after login is essential to get to inner pages.
You help/guidance is much appreciated.
Thanks
I'm begining too and having same problem. This commands work for me:
clik
link=menuName
clickAndWait
link=subMenuName
Hope it helps.
Maybe element not found just because it not loaded yet.After log in you can try to use command
waitForElementPresent and then click on element.
It seems you refer to an element by css, you can try id or name
I think before appearing the menu Selenium trying to click.
Just use
Thread.sleep(5000); // for five second waiting or more you can use
Another way use -
WebDriverWait wait = new WebDriverWait (driver, 30); // maximum wait 30 seconds
wait.until(ExpectedConitions.PresenceofElement(By.id("Menu_id"))).click();
Add wait and never try learning selenium through IDE .
disadvantages of using IDE is you cannot add conditions ,loops and wait in your code and cannot maintain the framework.

The form component needs to have a UIForm in its ancestry. Suggestion: enclose the necessary components within <h:form>

Here is my form:
<form action="j_security_check">
<h:panelGrid columns="2" bgcolor="#eff5fa" cellspacing="5" frame="box" styleClass="center">
<h:outputLabel value="User ID:"/>
<h:inputText id="j_username" tabindex="1" />
<h:outputLabel value="Password:"/>
<h:inputSecret id="j_password"/>
<h:outputLabel value=""/>
<h:commandButton id="login" value="Login"/>
</h:panelGrid>
</form>
It work fine with Glassfish 3.0.1, but since Glassfish 3.1 b2 it shows this warning as a FacesMessage in the JSF page:
The form component needs to have a UIForm in its ancestry. Suggestion: enclose the necessary components within <h:form>
If I change the <form action="j_security_check"> to <h:form>, it does not fix it, I have to place the <h:form> inside the <h:panelGrid>.
This is just a Warning not an Error. Warnings are usually there to inform the developer about unforeseen situations/conditions which might not immediately cause technical errors/problems. Anything may just work flawlessly, but the behaviour/results may probably not be as the developer intented. A newbie developer may for example accidently have used <form> instead of <h:form>. Warnings like this are then helpful.
In your particular case, you are simply forced to use <form> because of the need to submit to a non-JSF service. You as a more experienced developer know that it's legitimately valid. You can just ignore this warning. This warning will only appear when javax.faces.PROJECT_STAGE is set to Development anyway and not appear when it is set to Production.
However, that it still displays the warning when there's another component like panelgrid in between the form and its input children, is a bug to me. I'd report it to the Mojarra guys. It look like as if it is checking the immediate parent only and not all of the parents. Update: it has been fixed as per Mojarra 2.1.3/2.2, see also issue 2147.
This is by the way not Glassfish specific. The newer GF version of course ships with a newer Mojarra version which has those warnings implemented. See also issue 1663.
Related questions:
The form component needs to have a UIForm in its ancestry. Suggestion: enclose the necessary components within <h:form>
This was suggested to me by Oleg from the PrimeFaces forum and works:
<h:form id="login" prependId="false"
onsubmit="document.getElementById('login').action='j_security_check';">
Regards,
Brendan.
It only shows if you are in JSF Development based on your web config.
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
When you change it to Production it wont show anymore
If anyone will find this usefull one day,
i had same error and the problem was that i have primefaces component
<p:something ....
and that component was not inside <h:form> element
I'm using Mojarra 2.1.27 and find out that this is my mistakes. However its just very hard to find what the mistakes was. Hopefully someone from Mojarra could add component id to the warning messages.
Here is what I did to found out the component: (which also posted to https://code.google.com/p/primefaces/issues/detail?id=1586#c48)
I trace it by downloading the Mojarra source code and adding break point to com.sun.faces.context.FacesContextImpl class in method:
public void addMessage(String clientId, FacesMessage message).
when the break point catch, open the Debugging window or call stack window to find out that it was called by class
com.sun.faces.application.view.FormOmittedChecker
in method
private static void addFormOmittedMessage(FacesContext context)
which is previously called by method
public static void check(FacesContext context).
inside the check method there is parameter variable component.
You can get the component id from Watch or variable window and then trace it back to your html page and code.
Its a hard way, but hope you can find the root of the problems. It will be much more simpler if the warning message also display the problematic component id
In my case, this warning message was displayed in p:messages which I've put in dialog to show validation errors, so I've just included severity="error"in p:messages and warning message was gone.