How do I programatically send keys to a TWebBrowser to fill in data fields like Name and address?
If you want to fake input you need to use the SendInput API.
However, that's going to require you to make sure that field in question has the input focus. I suspect you would be better off poking the data in through the DOM (IWebBrowser2.Document).
I guess you want just to fill in some data in some edit boxes.
If yes, this might be useful for you http://delphi.about.com/od/twebbrowser/a/submit_web_form_2.htm
The most robust way would be to use the DOM as suggested previously. However if you end up going via the simulated input route, the Delphi SendKeys unit will make things much easier.
Article and download available here: http://delphi.about.com/od/adptips2004/a/bltip1104_3.htm
Related
Im trying to send some data to a form on a site were im a member using cURL, but when i look at the headers being sent, they seem to have been encrypted.
Is there a way i can get around this by making the computer / server visit the site and actual add the data to the inputs on the form and then hit submit, so that it would generate the correct data and post the form ?
You have got a few options:
reverse engineer the JavaScript that does the encryption (or possibly just encoding) process
get a browser engine (e.g. the Gecko engine), and add some scripting to it to fill in the forms and push the submit button - of course you would need JavaScript support within the page itself
parse the HTML using an HTML parser, feed the JavaScript in it to a JavaScript runtime with the correct libraries, fill in the "form" and hit the submit button
It's probably easiest to go for the first option. The JavaScript must be in the open to be able to be executed in the browser. But it may take some time to reverse-engineer as it is likely obfuscated.
You can use a framework to automate user interaction on the web pages, like Selenium.
This would enable you to not bother reverse engineering anything.
Selenium has binding in various languages, including Python and java.
Provided the javascript is visible on the website in question, you should be able to simply copy and paste their encryption routines to prepare the headers exactly as they do
A hacky fix if you can isolate the function that encodes the data you type in the form - is to use something like PyV8 to execute the JS inside python.
Use AutoHotKeyIt and actually have it use the Browser Normally. It can read from files, and do repetitive tasks infinitely. Also you can push a flag to make it only happen within that application, which means you can have it minimized and yet still preform the action.
You seem to be having issues with the problem of them encrypting the headers and such, so why not simply use that too your advantage? Your still pushing the same data in, but now your working around their system. With little to no side effect too you.
Looking on the Delphi newsgroups, it appears the best way to GET content from a WebDAV server is to use the built in TIdHTTP.Get. While doing this, the result is HTML and I just want to make sure that this is the best way to retrieve data about the directories and files. If so, then I'll parse it out, but I just want to make sure there isn't a cleaner way that may have JUST the file/folder information for me... And no, as of now I am not looking to use any other components for this.
Answering my own: I think I figured it out - I did a PropFile with allprop and a depth of 1. That seems to give me everything in a current "directory" and I can drill down with that. Unless there is a nicer way (or if I am not using PropFind correctly), I will consider this closed. References that were helpful:
Spec: http://www.webdav.org/specs/rfc2518.html
XML schema: http://code.google.com/p/sardine/source/browse/trunk/webdav.xsd?r=123
I have to make formatting available for a text box in a web based application just like the options available here to make selected text bold or in italics. I don't know where to start. can anyone please guide me.
Thanks
Why reinvent the wheel? Use something that already exists:
TinyMCE
CKEditor
Here's a list of ten different rich text editors that will do what you need.
http://www.queness.com/post/212/10-jquery-and-non-jquery-javascript-rich-text-editors
Depends on what you're going to be coding in, but I'm sure most languages have built-in types for text boxes that can handle formatted text (not unlike the one I'm typing in right now), and probably have a method that returns the contents of the box.
All you'd need is to figure out is the format code, if you want to store this text and open it elsewhere.
If you want to create from "scratch", you can use any JavaScript framework to ease your work. There are many "good" frameworks out there:
jQuery, ExtJS, GWT, YUI, etc. Just choose the one that suits to your need.
http://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks
There are some people in my office who insist on using cute stationery and some of it makes messages difficult to read. I really just want to read email on a white background with no distractions. Is there a way to disable stationery on incoming mail in Outlook? (Without switching to "plain text only")
yeah, I yanked that description from here
but it is very accurate however I've had no luck in finding a solution. Most solutions I see solve the problem by pushing out something to a bunch of users.
like : this
I don't really have the authority to do that. Not only that, that only prevents ME from setting stationery.
this has been asked before to no avail:
I don't have time to deal with this, so hopefully there is something I have overlooked.
Without switching to "plain text only" I want to be able to change a setting on my computer (it can be. a reg hack, I don't care) that will prevent outlook stationery from showing up in my email
it would also be helpful to know how to do it for Outlook 2003 as well.
No such setting/reghack exists. you would need to override the Item_Open event and change the message format from html or RTF (if either are detected) to Plaintext. This is the only way you could reliably strip out all the formatting junk without losing the text.
that or write a custom parsing agent (which would seem to be a bit harder).
either solution involves coding an addin to handle the open event and change the message format before displaying the message.
I'm not aware of a setting, but could you copy the text and paste it in Notepad?
I use that all the time to remove obnoxious formatting.
I am unlucky to be in charge of maintaining some old Yahoo! Store built using their RTML-based platform.
Recently I've noticed that HTML code generated by some RTML functions is sprinkled all over with "padding images" (or whatever is the conventional name for those 1x1 pixel images used to enforce layout). I have nothing against using such images, but... all those images are supplied with an ALT attribute like this:
<img href="http://.../image1x1.gif" alt="pad">
With all due respect to the original authors of RTML, but they must have been smoking something when they came up with this "accessibility enhancement"... :-(
Anyway, here are my questions:
Does anybody know a list of all RTML functions that generate HTML with all these "pad" images?
Is there any way to get rid of all those alt="pad" attributes without rewriting a lot of RTML code?
NB: This may sound a little cynical, but improved accessibility is not the main goal here. The main goal is to stop exposing those moronic alt="pad" attributes to Google and other smart search engines. So client-side scripting is not going to help, as far as I know.
Thank you!
P.S. Probably, most of you are really lucky and never heard of RTML. Because if somebody would establish a prize for software products based on
commercial success
------------------
usability
ratio, this RTML-based "platform" would probably win the first place.
P.P.S. Apparently someone from Yahoo! finally listened, because I can no longer find those silly "pad" tags in the RTML generated for our store. Nevertheless, one of the ideas offered in response to my original question does provide a very practical solution - not just to the original problem but to any similar problem with RTML platform. See the winning answer - it's really good.
The only way I see is to have your own website front-end that will filter whatever you want from the RTML site....
for example, your rtml site is at http://rtmlusglysite.yahoo.com/store/XYZ01134 , you could host a simple PHP front-end at http:://www.example.com that would be acting like a "filtering" HTTP web proxy, so http://rtmlusglysite.yahoo.com/store/XYZ01134/item1234.rtml would be accessed by http://www.example.com/item1234.html
It's not an ideal solution, but it should work, and you could do some more fancy stuff.
Nice try from the other posters, but there is a very simple RTML command that will do it. . .
TEXT PAT-SUBST s GRAB
MULTI
HEAD
BODY
TEXT #var-with-alt-tag-equals-pad-in-it
frompat "alt=\"pad\""
topat ""
The above RTML will find all instances of alt="pad" and replace it with nothing.
Well you're right on RTML being relatively untraveled :)
Do you have a way to add your own attributes to these images tags? If so, would it be possible to override the alt attribute? If you specify alt="", I would think that would override Yahoo's... Otherwise consider putting a useful alt tag in there for the blind and dialup types.
It's the first time I'm hearing about this platform, but here is an idea: if you can add javascript to the pages, you could write a function that will run after the page has loaded and remove all the alt="pad" attributes from the page.
Unfortunately this solutions works only with browsers that know about scripting, so lynx or some other text based browsers might not support it.
I have shared a link official RTML guide from yahoo. Hope it will help. Thanks!
List of available RTML books and resources