Trigger click with chrome console - javascript

I'm trying to trigger the click event on the Valid for and the Begin form fields in this Angular page using Chrome Console, I tried Javascript and jQuery using .click() or .trigger('click') with no luck so far. I'd expect when one of these fields is clicked the relevant dropdown would appear like it would if you manually click it using the mouse. Could someone help please?
https://www.eex-transparency.com/homepage/power/germany/production/usage/actual-unitwise-production-100-mw-
Thanks!

Related

Unable to click an RadioButton with HtmlUnit

I'm having a terrible time on HtmlUnit, there's this Frame im into with an TextField, a Button related to the TextField, an RadioButton and another Button. In order to the RadioButton to be clickable i gotta fill the TextField and click for "Search", then click the RadioButton in order to click the last button in the form, which generates an List of contracts. Though it doesn't do so. I have like 99.999% sure that the RadioButton with 2 JS events isn't working, it has both an onMouseDown and an onClick event. I've tried trillions of different methods doing the same things, waited lifetimes for JavaScript with Thread.Sleeps() and waitFor's... Nothing seems to work, the JS events won't work or the RadioButton isn't being actually pressed, i know that because the last Button on the page returns me an error saying its conditions hasn't been fullfiled. Any idea what could be causing the RadioButton to just don't work? Im sure im referring correcly to it, i've tried XPaths, Id's, everything.
Thanks to whoever reads this and try to suggest something.

Webpage doesn't refresh after input

Currently im working on automating a website with selenium python. I have this problem whereby when i enter J590 into the target textbox MANUALLY, i will have to click anywhere on the website or pressing tab which than will refresh the website and an option will be available in a dropdown box. However, selenium does not seem to be refreshing the page for me.
I tried to use click() before and after sending J590 into the textbox,i also tried using send_keys(Keys.TAB) after sending J590 but none is working.
Here is the code i used to send inputs
driver.execute_script("document.getElementById('CustCd').value+="+ dumps(jcode))
Here is the code i tried after sending input
driver.find_element_by_xpath('//*[#id="Item"]/form/center/input[2]').click()
or
driver.find_element_by_xpath('//*[#id="CustCd"]').send_keys(Keys.TAB)
May i know why is selenium acting this way and is there a solution to it.
Seems to be the keyboard/onchange event are triggering when you tab out or click on another element in the page as you are using js to enter the data. So, you have to dispatch (simulate) the corresponding event.
Refer to this post to know the associated event(s) to the element.
Let's say if you want to trigger onchange event on an element, then you should get the element first.
ele = driver.find_element_by_xxxx(yyy)
then send the event to the element using the js as shown below.
driver.executeScript("arguments[0].dispatchEvent(new Event('change', {'bubbles': true,'cancelable': true}));",ele)
Make sure you returned the correct element. And change the event name accordingly.

JQuery.Dirty Fields not work on first `updateFormState` but work on second

Using jquery.dirtyFields for updating form state on button click. It worked fine on button click which passes through following code
$('#hidChangeBox').val(true);
$.fn.dirtyFields.updateFormState($("#formId"));
But it does not work fine first time on button Click. Could anyone suggest what reason it could be?
Following Link for reference: http://www.thoughtdelimited.org/dirtyFields/documentation.cfm
Could it be the type of field? The library doesn't seem to be aware of the new field types in HTML5. i.e. input[type='number']

Enable resetZoom button

Something is wrong for me. I created a chart using version 1.2.2 and the reset button worked fine, no problem at all the reset button is there ("Redefinir Zoom")
But when I updated to version 1.3.4 the button is gone, the button does not appear.
I used the same position code on the .js file
position:{align:"right",x:-43,y:-56}}}
Already tried editing it and no luck, the button does not appear.
Is there any setting to enable and disable it?
Thanks
How did you manage to show that button? Probably you were using some old inner function to achieve that which doesn't exists in 1.3.x. To show that button try to call chart.showResetZoom()

'next' in the dropdown on iPhone Safari does not trigger on change event

I am trying to do a straight forward cascading dropdown for mobile safari. I have this working 100% in safari itself, which shows normal style drop downs. But mobile safari dropdowns have a 'next' button.
Hitting this next button takes you to the next drop down in the cascade with triggering onchange() - thus the next dropdown is empty.
The user is forced to press 'done' to trigger on change, then click on the next dropdown.
Does anyone know a way around this. Or what DOM event is triggered by mobile safari's''next'?
Disabling the second drop down from the beginning is the only work around I have found so far! it will disable the "next" button on iphones
Add the disabled attr (disabled="disabled") to you select and use javascript or jQuery to enable or disable.
here is the jQuery code
$(".DD1").focus(function() {
$('.DD2').attr('disabled', 'disabled');
}).blur(function() {
$('.DD2').removeAttr('disabled');
});
here is a live example that is doing this
using jQuery:
http://www.imotors.com/mobile
That's an iOS native overlay, so what you'll get is a blur event when that overlay comes up. Try using the blur event and see how that works.
I have tried many direct solutions to solve this problem with no success. The second pulldown is populated after Safari Mobile's "form assistant" overlay comes up with the spinner (called a "picker" in documentation - http://developer.apple.com/library/ios/#DOCUMENTATION/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html), comes up. So the picker is populated with old values.
In another case, if the second cascading pulldown is inactive, the Next button of the form assistant skips right over it. In that scenario, though, once the following form element is landed on, the second pulldown does update itself correctly, so tapping "previous" at that point gives the correct list in the picker.
My "answer" is that Apple is suggesting that JavaScript based cascading pulldowns should not be used but that another UX is to be implemented though I have found nothing that describes this aside from the standard jQuery Mobile type paging menus.

Categories

Resources