Primefaces p:fileUpload add onClick functionality - file-upload

I want to start p:poll when user click on upload button on p:fileUpload
NOTE: when i put manually onclick script into the button using browser elements works fine. i want to do that same

Basically when the user clicks on the upload button the onstart event is fired so you can use it.
<p:fileUpload onstart="PF('pollWV').start()" />

Related

I want to test a submission form but the click on the submit button calls on a api from a different domain in Cypress

Lets say I want to automate a lead form with name and number in cypress,
I click on Submit button
The BaseUrl is https://localhost:8080
On clicking the Submit button manually, an API is triggered with URL https://localhost:9010
But in Cypress
Api is not triggered , and no action occurs on clicking the submit button .
Can somebody give a solution or a workaround for this issue??

How to add a onclick pop up form on a page?

When someone clicks on a button then a pop up form will appear.
I am trying to do but don't know how to fix it.
You can open new popup window form by javascript as you have to
call following with onclick event of your button
window.open(url, 'new tab', 'width=700,height=500');
You can also close this popup window after success of form submission by following
window.close(url);
In url you have to add your url.
If this is not work please share more information. thank you

VB.NET WebBrowser Control OnClick Event Not Triggering

I'm using Vb.Net to trigger event listeners in a web-browser control, however it only seems to work on some site and not on others...
WebBrowser1.Document.GetElementById("button name").InvokeMember("click")
WebBrowser1.Document.GetElementById("button name").InvokeMember("Onclick")
It works on sites like adf.ly, gmail, google, but not on others.
for example, On the airserver log in website (http://www.airserver.com/Download) it only works for some buttons. The "download for free" and "buy now" buttons all work.
But, the popup (comes up when you press download for free) has a "register for trial" button. I have tried to use these codes, they do not work. (Yes, I have put in my name and email into the required fields)
WebBrowser1.Document.GetElementById("registrButton").InvokeMember("click")
WebBrowser1.Document.GetElementById("registrButton").InvokeMember("Onclick")
I have also looked at the chrome event break-point, it tells me that it a "click" event was triggered.
This is the html code for the button if you are not bothered to go to airserver
<a id="registrButton" class="button register" href="#" onclick="$('#promoRequest').submit();return false;">Register for Trial</a>
It's because it's a pop up (probably ajax and the code is not viewable in the webbrowser).
But the solution is here, use this link would 100% work:
http://www.airserver.com/register/PC
then redirect back to your download page, and do whatever you were doing.

asp image button click event with JQuery Mobile

I have been working on a site in VB.NET and JQM - and all has been going OK.
Now, I am trying to include a standard Image button using a tag such as:
<asp:ImageButton ID="btnYear" runat="server" ImageUrl="~/images/buttons/year_btn.gif" />
and in the VB code behind file there is a click event similar to the following:
Private Sub btnYear_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles btnYear.Click
Session("TimeFrame") = "YEAR"
*do other code*
End Sub
When I click the Image Button and trace the code - all the code in the page events in the code behind file fire (page load, page prerender, etc) - but the click event for the image button never fires.
If I replace the Image button with a standard asp:Button and do all the same - then the click event in the code behind fires just fine! Is it not possible to use an ASP ImageButton within a JQM page and hold a click event in the VB Code behind file?
EDIT
Ok much appreciation to andleer for his response - but it brings a new scenario (problem) with my page to light, also concerning these ImageButtons.
I have the ImageButton controls contained within a user control. My page is a single ASPX file with multiple
<div data-role="page">
elemenst in it, each with its own ID ("page1", "page2", "page3", etc) - following the standard usage of JQM's multi-page functionality. Each "page" section contains an instance of the user control that contains the Image buttons. This all works well, with one problem - when the user navigates away from the default "page1" to any other "page" and clicks one of the image buttons, the code fires, the page reloads - and lands the user back on the default page - "page1".
This is no good - I needed a way to allow the user to fire the button and reload the page and stay on the "page" element they were viewing - JQM accomplishes these multiple pages using hash tags in the URL - so I found a line of code that I added to the page's load event which read:
`Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Form.Attributes("onsubmit") = "this.action+=top.location.hash;"
End Sub`
I was originally using radio buttons on my user control - which JQM was "skinning" so they appeard as buttons - and with this one line in the Page_Load event, a user could click a radio button on any "page" element and the code behind the radio buttons would fire and the page would reload with the user back on the same "page" element they clicked from - not so replacing the radio button with Image Buttons - when I add that line of code to the Page_Load event, the ImageButton controls completely cease to function - when I click the the code in their click even in the code behind does not fire - nor do any of the page level events such as Page_Load or Page_PreRender - clicking them now does absolutely nothing....
Any thoughts on this?
A new answer to address the second part of your question:
I have found that asp.net web forms simply doesn't work with jQuery Mobile multi page scenarios. Web forms requires all web controls to reside within a single <form /> element that needs to span all jQuery Mobile ("virtual") pages. This is in direct conflict with jQuery Mobile's need to have <form /> elements within each sub page for proper rendering and post packs.
Consider MVC instead.
The issue is that an <asp:ImageButton /> renders as a <input type="image" /> which is hidden by jQuery Mobile. Add a data-role="none" to you ImageButton which will cause jQuery Mobile to render the control as is.
<asp:ImageButton id="MyButton" runat="server" data-role="none" />

Cannot click Submit button on Selenium IDE

I am having trouble getting Selenium IDE to click the Submit button on one of my webforms after having selenium open and fill out the form. I am using the clickAndWait command and identifying the button by its ID:
<td>clickAndWait</td>
<td>id=ctl00_ContentPlaceHolder1_OSVFHResults_btSave</td>
<td></td>
Interestingly, if I write a script that simply opens the form and clicks the submit button without filling it out, I am not having any problems. My problem is coming specifically after I've asked Selenium to fill out the form. Additionally, if I try to manually click the submit button, it doesn't work if the Selenium script to fill out the form was run before my manual input. If I manually open and fill out the form, I have no problems clicking submit, and Selenium works for all of the other form's submit buttons on the site. Anyone have any ideas?
Instead of filling form with type command you can try typeKeys one. It simulates keystroke events on the specified element, as though you typed the value key-by-key and probably enable your submit button.
It sounds like some javascript event unrelated to click() (such as mouseover or onkeydown) is attached to one or more of the form fields and is responsible for enabling the submit button.
You'd have to look at which exact events are being fired, either by looking at the source with something like firebug, or by using a javascript debugger. Then modify your Selenium script to make sure the same events get triggered.
After type the values in the form just try "ClickAtandWait" instead of "clickandWait"..i also face the problem once and it gave hands once..
selenium.clickAtandWait("locator", "position");
if you know the exact "position" just put it, otherwise leave it as an empty string.