I am working on a firefox addon that will automatically populate the login form fields and login. What I have access to could be anything from id's classes' or the xpath to the login button depending on what the website gives. The priority captured will usually be id's if they exist. The specific website that won't trigger the click is: https://login.paylocity.com/escher/escher_webui/views/login/login.aspx
I tried using $(element).trigger('click') or $(element).click() and they both don't trigger the click automatically. The error in the console log shows:
XrayWrapper denied access to property callee (reason: value is callable). See https://developer.mozilla.org/en-US/docs/Xray_vision for more information. Note that only the first denied property access from a given global object will be reported.
I also tried the Javascript method shown here: Is it possible to trigger a link's (or any element's) click event through JavaScript?
That doesn't work either.
XrayWrapper denied access to property callee
This suggests that the script is running in an environment that has higher privileges than the page content itself, which in turn results in some security barriers (the xray wrappers in one direction, access denied errors in the other) since the caller now is partially privileged code which content is not allowed to access.
Instead of using jquery you could try manually synthesizing a DOM event and firing it, possibly by accessing the unsafe window.
Something along the lines of new window.wrappedJSObject.MouseEvent("click"), same for dispatchEvent().
Alternatively you could also try firing a submit event on the form instead of a click event.
Yet another approach is to make .callee accessible by transplanting the calling function into the content window.
Related
I have a html web resource that has
<script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>
in the head. It is a frame that pops up when a user clicks reject in the ribbon.
When I try to click on a reject button in the frame (not the ribbon), it throws the error "Error: Unable to get property 'entity' of undefined or null reference" I know my
window.parent.Xrm.Page.context.getServerUrl()
is working because the lookup frame is populated from our server. I have tried the following :
window.parent.Xrm.Page.data.entity.attributes.get("approvalstatus").getValue()
and
window.parent.Xrm.Page.getAttribute("approvalstatus").getValue();
Both give me errors. I'm totally lost as to why I can't access the parent window's Xrm.Page object. Please advise.
I'm not 100% sure, but I can see a couple of problems.
1. I don't think you are using ClientGlobalContext.js.aspx correctly
I don't think you should be usingwindow.parent.
I think you should using GetGlobalContext which returns Xrm.Page.context.
For example; GetGlobalContext.getServerUrl()
2. getServerUrl() is deprecated
Use getClientUrl() instead.
3. I don't believe GetGlobalContext gives you access to Xrm.Page.data.entity anyway
GetGlobalContext only gives Xrm.Page.context
Xrm.Page.data.entity is a different object.
4. I think you should be passing form data into the web resource
This involves you writing JavaScript on the CRM form, that passes values to the HTML web resource.
(As opposed to trying to read the CRM form client side from within the web resource. You could also consider making a web service call from your web resource to CRM as well).
Use the getValue method on the attributes that contain the data that
you want to pass to the other website, and compose a string of the
query string arguments the other page will be able to use. Then use a
Field OnChange Event, IFRAME OnReadyStateComplete Event, or Tab
TabStateChange Event and the setSrc method to append your parameters
to the src property of the IFRAME or web resource.
Keywords are important.
HTML page within IFRAME in form can access parent.Xrm.Page.data.entity
Opening frame (popup as dialog/non-dialog?) from Ribbon button, it depends.
If you are opening a modal dialog, then you will not be able to access the parent Xrm context - you will need to pass the values in and then when the dialog is closed, update based on the result.
If you are opening a non-modal dialog then you can use window.opener
Reference: Scott mentioned in community thread
Otherwise, send the record Id & Retrieve again in popup window using soap/odata/webapi.
Solution was to use XrmServiceToolkit. I was trying to update the parent page’s Xrm.data.entity from child page that was opened using showModalDialog but that doesn’t seem to be possible.
XrmServiceToolkit lets you create SOAP requests that allow you to do all CRM operations. Use the format like explained in this link:
Is there a way to retrieve details of GET requests of a web page using JavaScript? I don't mean parameters of the current page's URL but out-going GET requests.
Example:
If you open google's start page with firefox and toggle developer-tools, in the network tab you can see a number of GET request such as that for the logo which is something like https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png
I want to retrieve this URL on console tab using JavaScript. Is it possible to retrieve it via an object attached to the DOM (document) or BOM (window)?
The reason for my question is: I am in an test automation environment where developer-tools are not available. Only JavaScript is available and I need to check the URL of a GET request issued by the current page. I just mentioned developer-tools because it is the simplest way to reproduce the problem (and the easiest way to verify, if a solution works). But it is more about Firefox/HTTP than test automation as such.
I don't think it's possible within devtools, but you may be able to use normal JS to make a global event handler (if it's jQuery) or if using normal JS, replace the XmlHttpRequest object with a duckpunched object that logs the result, as described here.
I am dealing with an input element inside of an ASP.NET or ASP.NET MVC ASPX page with minified JavaScript. I don't have the C# source code for this page because it is not distributed, but I can still modify the .aspx file pertaining to this input element and inject my own JavaScript into the page.
The input element has some sort of value, property, or attribute on it that is used by the page to supply a value to a JSON object that is passed back to the server on submit.
I would like to trap any events that try to grab properties, attributes, or values from the element and debug the call stack to see where it's setting this JSON property. I would like to know what techniques or tools I can use to do this style of tracing, because I haven't been successful in finding the events that are called when this happens, particularly because inspecting elements with IE's F12 tools have lead to a dead end for me.
You can try with Fiddler. It allows you to see all the traffic (from all browsers, to and from all websites), and see the calls to servers and the responses.
For example you can turn it on, then go to the site you're working on, click or do whatever it needs, and check in Fiddler if there was a post or get, and see if the server responded with a json object, xml, or if it had a 200 code or 404 or something more.
I hope this is useful.
I want to find if the url is being accessed is entered by the user or if its something that's being loaded in the background due to other reasons. This information is available through the transaction qualifier that's available in chrome.webNavigation.onCommitted. I want to add this as an additional header information in chrome.webRequest.onBeforeSendHeaders.
However, onCommitted is fired after onBeforeSendHeaders.
Is there any other way to get this information before OnBeforeSendHeaders is fired? I tried chrome.tabs.getCurrent in webNavigation.OnBeforeNavigate, but the callback doesn't have any info in the returned tab object (its undefined).
Any help will be appreciated.
i have been working on trello api so my issue is that i have to save a token in database.
response is in post message :
window.opener.postMessage("token generated here ", "http://www.servername.com")
1. how to fetch token from post message.
2.i have tried code from this link :http://stackoverflow.com/questions/3332532/how-can-i-do-cross-domain-postmessage. but is not working.
3. https://developer.mozilla.org/en-US/docs/Web/API/window.postMessage this link i also go through .
snapshots step by step here is
step 1: authentication with oath :http://postimg.org/image/5cwazfvfv/
step 2: when i press allow button to get token i recieve this window and here
url: http://postimg.org/image/f3y34m2dz/
As I know, postmessage is asynchornious. Consequently, it's hard to capture which message is returned to which source parent/window. I think we can consider 2 things as below:
It's reasonable define how to determine which target window (instead of "*" indicator). In my case, we can temporary use like that: frameA.contentWindow.postMessage(msg, frameA.src). However, my solution still face problem if we need to support many frame has the same href.
The second thing is needed to point out which target page will received/handle returned value from frame. As above thing, my solution is rely on origin property of event object (used for Chrome/Safari browser for instance. In case other versions/browser, we need use corresponding property).