how to read ellipses data in java or using selenium - java

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.

Related

How to validate a text value in two different places

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

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

Dynamically highlighting strings in javaFX

Please read before labelling this as a duplicate.
I am creating an application that calculates how fast a person can type by calculating WPM and CPM. However I have hit a snag with the UI as I found out that you cannot really highlight individual strings in a TextArea. My goal is to compare what the user is typing to the random text that is generated by having it so that the text is being dynamically coloured or highlighted as the user is typing.
See http://10fastfingers.com/typing-test/english to get an idea of what I mean
I recently read the following post Highlighting Strings in JavaFX TextArea
I was trying to achieve the same goal of highlighting individual strings inside a javaFX TextArea until I realised that it pretty much is not possible. So I looked into TextFlow which does allow me to edit individual strings. The problem with TextFlow is that all 200 of the generated words would have to appear at once which is not what I want. With a TextArea not all the text has to be displayed at once.
This is what I have so far just so that you can further get an idea of where I am heading with this.

Display a scrolling message that can be updates by another webpage

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

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