I request a web page in the browser and I should fill out the text boxes it has. They are too many text boxes and it takes too mush time too fill them and the result of this latency is an expired page. I have written those inputs in a text file (each line for each text box). I want to write a program that when it is running, it fills out the form and I just click the submit button of the website.
The form is something like the following image:
I have a form which somehow looks like the following image:
I searched a lot to find a way to fill out the text boxes automatically in C# but did not find anything. My question is that is there anyway to set the values of these text boxes in C# and send them back to server?
You can write a json object, then a javascript function that iterate that json and figure out by each value the selector of the correct input to use and set the correct value.
Then when the page open, use the dev console.
paste the json object, paste the function.
Run the function and the form should get fill out.
=)
Related
I'm trying to write an application for the game Path of Exile, that lists the items in my stash on trading websites automatically.
For this I have to retrieve the items in my stash from their website. For some reason the ".getText()" functions is behaving very weird on the website. I really can't see any mistakes I did with the x-path Expressions.
Example:
Here you can see a snippet from the HTML file I am working on
screenshot of browser debugg tool
In the screenshot you can see that the x-Path I am using is selecting a element with a text element, however when I iterate over the elements and get the text with the getText() function, it returns a empty String... I really have no clue what I am doing wrong, is it the website, that is denying me to access the field?
In case it helps I add here a screenshot of the source code for outputting the text fields
printing the text of the elements(SourceCode)
5 empty Strings as output
On your place I would try to get value instead of text.
try to replace
e.getText()
with
e.getAttribute("value")
or you can also try to play with .getCssValue()
I am trying to fill a website form(compareraja.in) to search and compare mobile phones using java. I currently am using the jaunt library, but I just cant get to know, how to fill an autocompleting textfield, what i want is to select a particular item from the autocompleting list after i apply a certain initial letters to the textfield. Is it possible with jsoup or jaunt or htmlunit or any other library?
if yes, which is the most better and easiest choice ? Also how can it be done?
My clue is that first of all you have to retrieve the whole autocompletion list which appears after you've applied a certain letters. If you open the web page in e. g. Chrome, go to Developer Tools F12, Network Tab, then you will see that each time you type a letter in the textfield, a corresponding XML HTTP Request is logged in the list.
For example, I've typed "htc ":
On the Network Tab the last one XHR Header section contains all the necessary query parameters :
And Response section shows the received data, which is actually being shown in that autocompletion list:
So, you can just make GET XHR to URL http://www.compareraja.in/autocompletedata.ashx?q=htc+&c=mobiles&limit=150 (you can even click this link or paste it to the browser's address line to test), where your URL-encoded initial letters should be placed instead of htc+. It works fine without timestamp parameter for me.
After that it's easy to parse the response, splitting text by \n and ; chars, and fill the textfield with selected item.
I'm looking for a solution to this and I have searched the web for an answer with nothing. I need a scrolling message on my webpage that can be updated by the same website but on a different page. (e.g www.webpage.com <-- has the scrolling message on it, www.webpage.com/settings <-- has a form in which you can change/update the scrolling message)
I'm pretty sure this is achievable with Java, but my knowledge on Java is slim and all my efforts have come to a fail. I have managed to get a scrolling message on my webpage and I'm sure if I could read a text file (with the message in) then assign that to a 'var', I could make that scroll but I don't know how to do that.
If you know a completely different method of doing this I am happy to change mine.
Thanks in advance,
Tom.
I would recommend javascript instead of java, since java is not really conventional anymore and looks ugly too (and requires a special plugin).
It depends on how fast you want to update the scrolling text how you want to do this. I would say save the text to a .txt or database from settings, and then have your page get it.
You can then use php to read the value from the .txt file or database to display it on your website.
If you want it to be extremely up to date you can let javasript call a little .php file that reads the file and gives you the content.
To make your text scroll you don't really need anything other than html, like so:
<marquee behavior="scroll" direction="left">Your scrolling text goes here</marquee>
You can read more about that here: http://www.quackit.com/html/codes/scrolling_text.cfm
I am running an applet in IE which is generated from an external VLX file.
The VLX file is pulling data from a database and when a user hover overs a specific icon when the applet is running, a hover over table appears, with four strings inside, more specifically one of the strings is a URL.
When viewing source it is not possible to see these string values, as they are generated by the VLX and then used by the applet, so the only code you can see is the applet code.
Is it possible to retrieve these strings? As I want to be able to use the URL to open a new web page.
I have it so when a user double clicks the specific icon, an alert is present to show where I am on the page, and within this event I need to use URL value.
This is not possible with the document.getElementById as these values are not accessible in the html.
We have a form that lets people input html formatted text and that input is then displayed elsewhere on the webpage.
Due to layout constraints the input may not be longer than X lines. There is no preview of the edited text in the webpage. Input upon submit is immediately published. (Short Explanation why I cannot fix the layout: the text in question is displayed as an overlay above an image. The overlay has about the size of the image and that is fixed. The text should be completely visible inside that overlay and should not spill over.)
I am being asked to implement something to keep people from entering too much text.
My first try was going for "maxLength" but goes wrong because of the possibility html formatting of the input.
Besides the obvious two 1. expecting users to be smart and/or 2. implementing a preview method, how else could we possibly solve this?
I am out of ideas, I'll also accept an explanation why it is impossible
Technology used: java, wicket 1.4.x
I'm not a web-development expert so this may not be a precise enough answer.
Using javascript you can get the effective size of an HTML element once it has been rendered in the browser. Thus, one solution could be to render the page server-side, and check whether the result exceeds the size you expect.
This may not guarantee a correct result however because the server may render the page differently than the client. You could also always accept the input, then when the client renders the page, have a snippet of javascript that checks (client-side this time) whether the rendered result is okay. If it isn't, then let javascript redirect the client to an error page so that it can edit his input.
What I'd do however is to change the layout so that nothing breaks if the user enters too much text. Using the CSS overflow property could be a start. You could also implement better solutions in javascript such as dynamically changing the text size until it fits the size you want.