How to click a button in the newest Qt5.7 WebEngine?
In the past Webkit, we could do this to click a button:
QWebElement button = frame->findFirstElement("input[id=search]");
button.evaluateJavaScript("this.click()");
So, how can I do the same thing with Qt WebEngine?
Thanks for any suggestion.
You need to move code that finds button to JavaScript, for example
var button = document.querySelector("input[id=search]");
if (button) {
button.click();
}
Then execute your JavaScript code with QWebEnginePage::runJavaScript().
Related
I want to create show and hide a alert bar using (alert) button click, If i click that alert button it needs to show what is that alert & again I click that button it needs to be (Hide) visibility gone...I want to switch that visibility thats all.
How to do this in android kotlin, I am new to this field, Plz help me..
This is my code
// for alert popup
binding.alertImage.setOnClickListener {
binding.alertImage.setVisibility(View.INVISIBLE);
binding.scrollText1.visibility = View.VISIBLE
}
I am trying to disable double clicking a Help label which is an anchor to open the Help window.
<p:a id="helpClick" onClick="help()">
<label value="Help" style="color:#FFFFFF;" />
</p:a>
When onClick() event is triggered once, either by Mouse click or Tapping the touchpad once, the help() method is being invoked.
void help() {
flag = true;
this.helpClick.setDisabled(true);
Window popupWindow = null;
popupWindow = (Window) Executions.createComponents("/zul/mainHelp.zul",
null, null);
this.popupWindow.setClosable(true);
popupWindow.addEventListener("onClose", new EventListener() {
void onEvent(Event event) throws Exception {
this.helpClick.setDisabled(false);
}
});
}
is the code which i added to handle the anchor tag with the id helpClick.
This is working perfectly fine when i use mouse clicks. For the first click, the window gets opened and simultaneously the Label is not taking any more click events.
When i try the same with mouse tap(using the touchpad), two single clicks are being triggered.
I have used onClick() to capture the event.
I am trying to disable the Label once it is clicked and the window is opened. Only after the window gets closed, i am enabling the label.
This is working totally fine when i use mouse clicks but not when i use tap.
With tapping, the label is taking multiple clicks which isnt the case with Mouse Click.
Without seeing code it's difficult to provide advice but maybe you can capture the onDoubleClick event and ignore it or forward it to the to the same listener as your onClick event.
... forward="onClick=onHelpClick,onDoubleClick=onHelpClick" ...
After question edit:
It sounds like a bug if you can double click a disabled component. One thing you could try is set your link to autodisable <p:a id="helpClick" onClick="help()" autodisable="self"> as per A component documentation
I have to open a modal popup on link click .In that popup i have to take some user details and on submit some server side code has to be executed and new popup is to be opened.But problem is that on button click new popup opens and as soon as server side code gets executed second popup closes.
Expand your question as much as you it helps in understanding your problem
Anyways I guess your problem is that the page gets post back... You need to open your second Modal Popup from Server Side..
Here is a nice example of it: http://www.codeproject.com/Tips/215040/ModalPopupExtender-from-Server-Side-Code
write this in your codebehid button click event
popupid.Hide(); //hide the popup which you dont want to show.
//it will close when you click on submit button
popupid1.show();
write this in javascript
<script type="text/javascript">
var ShowVerifyInventory = '<%=popup_verifyInventory.ClientID %>';
function ShowPopUp_verifyInventory() {
$find(ShowVerifyInventory).show();
}
var HideVerifyInventory = '<%=popup_verifyInventory.ClientID %>';
function HidePopUp_verifyInventory() {
$find(HideVerifyInventory).hide();
}
</script>
I have a classic ASP NET page on my SharePoint site with several buttons in it:
Button importZIPPOTBtn = new Button();
importZIPPOTBtn.Click += new EventHandler(importZIPPOTBtn_Click);
this.Controls.Add(new LiteralControl("<br/><br/>"));
this.Controls.Add(importZIPPOTBtn);
The first click on any button is perfectly firing the event, but any further click on any button doesn't fire, I can't understand why...
Consider aadding button to form1 or container element like panel inside page.
Button importZIPPOTBtn = new Button();
importZIPPOTBtn.Click += new EventHandler(importZIPPOTBtn_Click);
this.form1.Controls.Add(new LiteralControl("<br/><br/>"));
this.form1.Controls.Add(importZIPPOTBtn);
You can verfiy in html source, unless you add this way even literal control containing lines breaks will not be rendered.
In asp.net, I want to click on a button to open a popup windows. after the popup windows, I want to cause a full postback to the parent window.
How can I do this?
On your popup write the below script:
window.opener.PostBack();
// Where PostBack is the custom method of opener/parent window.
Either you can do it in OnUnload() event of your popup or from any other method followed by window.close();.
You can implement the PostBack() method like this in opener:
function PostBack() {
var btn = document.getElementById('<%=SomeButton.ClientID %>');
if (btn) btn.click();
// or
// __doPostBack('SomeButtonId','Arguments');
}