How to click a button which is not a form submit button during a functional test - symfony

During a functional test i need to click a button to make an ajax request.
When browsing the symfony testing docs, i realized that you could whether click :
a Link
or
a form's submit button
My button has the following id = "js-scroll-down"
When i try this:
$btn = $crawler->filter('#js-scroll-down')->eq(0)->link();
$crawler = $client->click($btn);
I get the following error:
LogicException: Unable to navigate from a "button" tag.

The Client#click() expects only Link.
But you can execute script, e.g. $client->executeScript("document.querySelector('#js-scroll-down').click()");

Related

Google-chat: Open dialog on Button Click

I post simple message with cards_v2. I placed a Button with properties:
action: {
function = "myAction",
interaction = "OPEN_DIALOG"
}
When I click on button I receive event but no DialogEventType is provided.
I tried to reply with Dialog payload, but Google says bad response.
I used this: https://developers.google.com/chat/how-tos/dialogs?hl=en#apps-script
Dialog buttons works only if I send a response on message. When I posted cards through API POST it doesn't work.
I can't say is this a bug of Feature.

bind button onClick method to keypress action

I have a button b, I want the document to understand a key press action has been triggered whenever I click on that button.
For example, when i click on that button, i want the document to recognize that the left key has been pressed and whatever the java script has been written for it should work.
I am unable to figure out how to do this. Please help.
You need to add an event listener to look for a click action. You can do this for a specific button, the first button that your code finds, or all buttons on the page if they all perform the same action. Actually, you can add this listener to just about any html object. Here's a simple snippet I got from https://developer.mozilla.org/en-US/docs/Talk:DOM/element.addEventListener.
<div id="ear">Click me</div>
<div id="display"></div>
<script>
var ear = document.getElementById('ear');
ear.addEventListener("click", listener, false);
function listener() {
document.getElementById('display').innerHTML = "blah blah";
}
</script>
What this is doing is creating a variable called ear, and assigning the div with id='ear' to it. Again, you can just as easily do this with a button, or any other tag. Then ear.addEventListener adds a click event, tells it to run the listener function, and the boolean at the end says if the parent's handlers should be run, as well all ancestors going up. Setting this to true will cause only the tag that was clicked to run.

Meteor: How to override verify email popup dialog which appears after clicking email verification link

I want to add some fields to popup dialog which appears when user click on verification email link sent to there email. Actually i want to extend the sign up process. So when user clicked on verify link i want to show some more fields like zip code and date of birth in popup and on clicking save those fields should save to user modal.
Any help will be highly appreciated. I am new to meteor.
I am using ian:accounts-ui-bootstrap-3 for sign up process.
Some more details if needed !
With the following package, you can replace templates :
https://github.com/aldeed/meteor-template-extension
So you create your own template, then replace the default one :
Template.emailVerifiedDialog.replaces("_justVerifiedEmailDialog")
Your dialog will be shown on every pages, you have to add the behaviour to make it visible when necessary
Template.emailVerifiedDialog.helpers({
visible: function () {
return loginButtonsSession.get('justVerifiedEmail');
}
And manage click button event :
Template.emailVerifiedDialog.events({
'click #just-verified-dismiss-button': function () {
loginButtonsSession.set('justVerifiedEmail', false);
}
});
Ok, i found solution myself.
Here it is if some one else also looking for this.
We can override email popup dialog by overriding login_buttons_dialogs.html file in /meteor-accounts-ui-bootstrap-3 folder.

How to press a button on asp.net web site using python+mechanize

There is a web site I need to scrape. I can fill in the necessary data. The problem is that I don't understand how to press the button to get the page with results.
The button has the following code:
<input type="button" value="Search!" onclick="SearchSmth();" id="btSearch">
So because the type is not 'submit' attempts to use Browser.submit() fail. I tried using something like this:
resp = b.click(type="button", id="btSearch")
but it also failed:
ClientForm.ControlNotFoundError: no control matching type 'button', kind 'clickable', id 'btSearch'
What should I do to get this button pressed?
Have you used zope.testbrowser? This is wrapper over mechanize module of python. You can use getControl browser.getControl(name='text-value') method of zope.testbrowser. You can see more examples here

Get access to ASP.Net CreateUserWizard buttons

I'm using a CreateUserWizard on my register page. The Sign Up button is part of a CustomNavigationTemplate.
I need to set the Sign Up button as the default button of a ASP:Panel, but can't do so since it's inside the template. I tried to do so, but I can't locate the Sign Up button using CreateUserWizard.FindControl, CreateUserWizard.WizardSteps(0).Controls(0).FindControl or other similar steps (this is a known issue with this control).
Any ideas on how I can expose this button, or set it as the panel's default button in some other way?
Here's how I finally did it:
Referencing the CreateWizard Button and assigning to Panel's Default Button:
Dim RegisterButton as Button = Ctype(CreateUserWizardStep1.CustomNavigationTemplateContainer.FindControl("RegisterButton"), Button)
RegisterPanel.DefaultButton = RegisterButton.ID 'Or RegisterButton.UniqueID
I wasn't able to use the above, because it was giving me the error "The DefaultButton of 'RegisterPanel' must be the ID of a control of type IButtonControl"
I finally created a dummy button called "RegisterButton" (same name as the register button inside the template) and hid it using CSS, and gave it's OnClick the 'real' register button's function call.
For the login section, I used this:
Page.Form.DefaultButton = LoginButton.UniqueID

Resources