I'm trying to get the content of a site, but this content only appears when I click the 'Chart' link, which is a JavaScript command like this:
javascript:__doPostBack('fcc1$dgrC$ctl02$ctl00',''
from a element like this:
Chart
This is the site:
And this is what happens when you click on 'Chart':
You can see that the link doesn't change, so the only way to get the chart code is by somehow send that JavaScript command
How to find all the chart links?
How can I do a 'virtual click' on the chart links?
And after that, how to get the new html?
I really appreciate your help!
doPostBack just sets the __EVENTTARGET and __EVENTARGUMENT form fields and submits the form. Those ''s are just quotes BTW.
If those links are indeed "clicked" by javascript listeners, you may have trouble finding a real link to click.
Instead, you could use a tool to simulate a web browser in python and "click" on that link to get to the next page. The best one I've used is Mechanical Soup: https://mechanicalsoup.readthedocs.io/en/stable/introduction.html.
Related
I'm trying to check if a button was pressed and then open a new html file, I'm using express.js app.get method to open all of my HTML files. So my question is how can I open a HTML file on the same window when I press a button?
You could but shouldnt. NodeJS is backend.
Also note, that NodeJS is no JavaScript as normally referred to.
It is written/programmed in JavaScript.
To do something on click you would need either a normal <a> tag if you just want to open a link or you use client-side JavaScript with an onlick handler to execute something after a user clicked on an element.
You can accomplish this using javascript embedded into the html like this:
<button onclick="window.location='http://google.com'">Click me</button>
you can also try window.open=url
please note that this isn't really using node, just javascript. this type of behavior belongs in the page.
I think this thread would help you :)
https://stackoverflow.com/a/33703429/4578393
it uses if statements to check if the button has been pressed
if(req.body.hasOwnProperty("butt1")){
console.log("butt1 clicked");
Taine
I have created a banner for Adwords, using HTML5 with a form element, which accepts few inputs, like your preffered color, type, etc.
The whole banner is not clickable, only the submit button, which I achieved by adding "onclick="ExitApi.exit()"" to the button.
All of this works fine, but now my question is, how flexible is this ExitApi?
Whenever I click the submit button, I want to append the generated parameters to the final url, which is set through AdWords.
Using the adwords preview I can see that during the redirect the last parameter is 'adurl' which contains my final destination.
Editing this manually and just typing in the parameters helps me achieve what I want, but how would I be able to append using the ExitApi js library, if that's even possible?
I also tried using a CTA through GWD using something like 'gwd.actions.gwdDoubleclick.exitOverride('gwd-ad', 'clickTag', 'http://example.com/index.php?some=var'+params, true, true);', which hasn't worked and is also limiting as it forces the developer to set the url through the banner.
Any ideas are appreciated!
Thanks,
Edvinas
If anyone is stuck on this aswell, just an update.
I have contacted Google Adwords Support about this and here's their response:
Unfortunately, multiple exit URLs are not supported in the AdWords environment. Doubleclick, on the other hand, can handle them.
https://support.google.com/webdesigner/answer/4450409
There are many nice components in GWD which could use different URLs, but they can't be deployed in AdWords.
I'm new to Ajax and was told need to use it for what I'm trying to accomplish here.
Here is the website... http://modocom.ca/gillons
If you scroll down up will see a section called Find an Office with drop down menu in it. What I need is for when someone click on for example Emo in the dropdown menu the location info from.... http://modocom.ca/gillons/emo goes under the dropdown and so on for each location in the dropdown and also when your on the Emo page for example you click on the dropdown menu and can choose different location and get new info as well for selected location.
Hope that makes sense and hopefully someone could give me a hand.
Thanks,
Mike
OK, I'm not going to write code as it looks as though you haven't actually tried anything yourself yet.
However, the sequence of events, one version of them anyway, might look like this.
Using jQuery, put a change event on your dropdown.
When the event triggers, and this depends on your backend as you have not spcified APS.Net, MNV, Java etc, you need to post back to a code file of some sort and pass in the value within the dropdown.
From there, in your c#, java, pythod, whatever, code, take that value, generate some HTML and return that HTML to the client.
At the client, you accept the HTML and fill say a DIV with the returned HTML.
If you are using MVC, you can return a PartialView which is a better design.
Does anyone know how I can dial a number using javascript? I've tried the following:
window.location.href = 'tel:7178081998';
The button registers a click but doesn't do anything in the ios environment.
I'm running into an issue where my "tel" links do not work because of a script that I have (FastClick). I've tried everything I can think of which is why I am at where I am.
Thoughts?
555-867-5309 This should work.
If need put a pop up dialog to ask user " Are you sure you want to call" Just in case s/he clicked it unintentionally.
<a id="call" href="">555-867-5309</a>
Use call id to open a dialog, on click of ok, put data dynamically to href attribute.
Sounds like a sandbox issue. Why not break out of the restriction with an iframe? Dynamically add it to the DOM and have it dial the number.
Adding IFRAME to DOM by Javascript
I am testing a JQuery Web application. I have a JQuery popup that I simply cannot get the submit button to fire in Watir. The same pattern is used thought the application.
I have verified the button exists and have tried click, fireEvent you name it and am out of methods to call.
Has anyone solved this?
Which do you want ?
A. Control cursor and click "submit"
or
B. Simula te click "submit"
A:need to use Autoit and control cursor and click ,but only for windows OS. B:execute the javascript that when clicking "submit".
If B case,there is two ways I used always.
1.execute that code in URL-bar.
ex.) #ie.link(:URL, 'javascript:<-CODE->;').click
or
Make like that module and use it by include in test case.
ex.) #ie.excute_script(<-CODE->)
module Watir
class IE
def execute_script(scriptCode)
WIN32OLE.codepage = WIN32OLE::CP_UTF8
window.execScript(scriptCode)
end
def window
WIN32OLE.codepage = WIN32OLE::CP_UTF8
ie.Document.parentWindow
end
end
Maybe...
I hope it help.
Sorry my poor english.
tknv/
In my case the solution was to use and index value of 1. JQuery creates a copy of the form and all the popup items have an index of 1. The 0 index controls are on the original form.
I just had the same problem. Ajax upload for jQuery demo is an example page. I want to upload a file using Upload button on the left hand side of the page.
When I click Upload button by hand, file upload pop up appears.
When I click the button with Watir, nothing happens.
Gary (accepted answer) helped me to find a solution:
browser.file_field(:index, 1).set "/path/to/file"