Continue after user done captcha Selenium - java

I am automating something for a website and at some point, the user has to manually fill out a captcha. How would I wait until the user correctly finishes the captcha to continue?

There are some of things you can do depending upon how your page behave that you are automating, its hard to exactly say with out looking at the page
If your save button does not enable until user put the captcha you can run a for loop and only break if the button is enabled
If your save button does not let move forward without putting the captcha and that check its doing at java script lever without reloading the page, you can just keep clicking the button in a for loop with a wait after each click.
You can also check the textbox where user put the captch in a for loop and can only break the for loop when user type certain number of char.
these are some ideas.

Related

Create a hyperlink that will expire after one click

I am creating an hyperlink that will be send to user mail(gmail in my case). I want to expire the link after user once clicked in it(I don't want the user to click more than once).Once user clicked on the link it will trigger subsequent mail to manager. Here I also want similar functionality.
Note: link has some encrypted data too.It should remain intact.
I solved the issue.Instead of relying on session.I am using last update value in DB to check the life of hyperlink.

On reload with default browser button go to original HTML

I have 2 html documents, first is like pre-load animation with button that goes to original site(2nd html). After i press reload page it only reloads and stays on second html document instead of going to beginning.
Can please someone explain this.
As for what understand from what you are doing, you can't just retrieve to previous page just by refreshing.
When you refresh in your browser, it'll reload the location.href.
If you can use javascript, you can try doing something like this
location.href = document.referrer
And you can create an anchor tag, or a link, on the second page to go back to the last page with a button similar to this (havent't tested it)
Back

Using AnimationManager from Android-pdfview

I am using Android-pdfview library to display pdfs within my application.
pdfView.fromFile(new File("/path/to/file")).defaultPage(1).enableSwipe(true).onPageChange(this).load();
How to use AnimationManager from Android-pdfview library ?
For example, I want to show each page for 10 seconds, and move to next page automatically without user interaction. Once last page is reached, loop again.

Java GUI input text box

I'm designing a program simulating a vending machine. You know how vending machines have that one large text box that displays whatever messages you need to know...that's what I want to do. So basically, if the user clicks a button and if the item is out of store, expired, they don't have enough credit, whatever, the message should be displayed in this box.
Then, after a second or 2, return to displaying how much money the user put into the machine. I also want to make the box so that, well theres a button next to the text box to click to insert money. When they click that, I want to make the text box editable, they then enter the amount of money they want to enter, then press insert again, and the money is inserted. The text box becomes uneditable again, and displays the credit they have in the machine.
Does anyone have any suggestions as to how to do this?
I also was wondering how I could implement the delay before getting rid of the message and returning to displaying the credit in the machine. Thank you.
As Andrew Thompson says, you would use a JTextField. Set the desired text using the setText() method and you could then use a sleep function (usleep() I think should work for your application) and then set the text again back to the Dollar value.
Edit: didn't see the last half. To enable and disable the textfield entirely, use setEnabled(true/false), to stop it from being editable, use setEditable(true/false)
Also, just thinking, you could get the current date in a timestamp format and then enter a loop where you continually get the timestamp and compare it to the first one. If the desired difference is reached then exit the loop and update the textfield. Have a look at the Java doc for Date ;)

Web Apps: Closeable Announcements/Info/Tooltip boxes

I want to understand how to implement an announcement/info box system that displays
a box for the user with information.
The user can do nothing or close the box, but then it will never be seen again.
E.g. Facebook home page. Box asking for Translators.
if you leave it then its always there.
But if you close it, it never appears again.
Does this mean that a Boolean value needs to be used and checked
for announcement/info boxes?
I'm looking for a pseudo way with database tables to do this?
This info goes into a portal page personalization attributes table for that user.
Each portlet will have Display set to True or False for each user.

Categories