How to validate a text value in two different places - java

I am having a scenario where i am pulling the text from an API and displaying in a callout say Text A (Ex - Address of a dealer in three lines) and I am pulling the zipcode value from Text A and doing a link decoration in the bottom of the page with Text B.
So i need to compare the text in Text A & B and pass the scenario if both are same, can someone please help.
Using Java Selenium.
Thanks
Venkat

Related

how to read ellipses data in java or using selenium

How to read data which ends with the ellipses(...) in java and selenium.
I have tried with the option as gettext().split(",")[0]. Each time the data length gets differently some times data will display with "," or some time data will display "Name..." in this situation it is difficult to get to know where the comma "," ends. When hover the mouse on the text will get display the full data on the tooltip. Please help how to handle it.

Filling out a web form automatically with a text file

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.
=)

how to web scrape autocompleting textfield

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.

How can I create a text box in SWT to display tags?

Has anyone seen the text box in Evernote that shows list of tags the user has entered? Each tag is sorounded in a circle with a x mark to be able to remove it. Or another example is the very stackoverflow when you put a tag you can see they are in small box rather than a comma separated text.
How can I do this with java swt?
Thanks

How do I get a value from a particular location on screen using Sikuli(Java)?

My scenario:
Trying to automate Calculator using Sikuli(Java). I need to get the result (in text) every time an operation is completed.
Example: 1 * 2 = 2. Need to capture '2' from the resulting area/region.
Can some one please help me how can I do it?
The result may be dynamic, so It becomes important for me to read it in run time and then compare it with the input values.
Thank you,
Mike
If the resulting area is a text field you can click on it, copy the text to the clipboard and read it from Env.getClipboard():
click("text_field.png")
type("a", KEY_CTRL)
type("c", KEY_CTRL)
print Env.getClipboard().strip()
Another way is to find left and right borders of the result field, drag the mouse cursor from left border to the right, copy the text via ctrl+c and use Env.getClipboard() to get it.
Hope that helps.

Categories