What is the best wait command to use in Selenium [closed] - java

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm in the process of building an automated test pack in Selenium using Eclipse and Java. What I'm finding as I am going along is that sometimes certain actions can take longer than they did previously. So, whilst I am aware that I need to implement some kind of wait command I was wondering what would be the most effective one to use? Essentially, what I want is for the web page to wait for X seconds before it returns an error in the console.
Also, based on peoples past experience, what would be the best way of implementing this? I'm thinking that I create some kind of 'wait commands' class, which will have a series of methods that can be used depending on the scenario. Is this the right kind of approach?

selenium has matured inbuilt wait mechanism.
It has implicit wait, which means when you navigate to a new page, it wait until the entire page loads, before doing any action on the page.
In places where Ajax is used, the above may not be of help, hence we have to use explicit wait to ensure ajax request is complete. ex:
(new WebDriverWait(driver, 10))
.until(ExpectedConditions.presenceOfElementLocated(By.id("myDynamicElement")));
Check out the following link, for more details
http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp#explicit-and-implicit-waits

Related

How to save changes in java? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm new to java and I'm recently working on a project which allows you to deposit, withdraw and create new accounts. I want to know if I can somehow save the changes after rerunning the code, for example, the change of users. I've tried several ways on the internet and they didn't seem to work.
There are a variety of ways to accomplish this. For a new programmer, I'd suggest learning how to read and write from files to start.
A simple database system is also an option, but probably more complicated than what you're looking for. This also can't be covered in one tutorial. If you're interested, you should probably do your own research and find something that works for you.
What you need is a database system.
In short, the database will store the data. Your program reads and displays that data. The user modifies it, and pass it to your program to "save" the data (which is replaced the old data with new ones in the database)

Design patterns for pre initialize data for one task [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I have working on developing scheduling application as a start up and application take some time to complete. during the scheduling process I cannot use service calls to load data, because it will reduce the performance. It may cause to terminate the process if data access failed.
So I need to load required data before starting the scheduling process and discard that data after completing the schedule. This is some kind of caching but it doesn't need all the features in caching like check for expiries, discard expiries update new changes etc. Need to load once a month only for the scheduling.
So can somebody tell me what is the best design pattern to handle that situation. Thanks
Well that's a place for Prototype pattern, but you should also consider using some caching framework and just disable all fancy features like expiration, pinning, etc.
In the test automation patterns such
need to load required data before starting the scheduling process and discard that data after completing the schedule.
is called fixtures. So what you need can be achieved with setUp() and tearDown() functionality. Generally a Setup Decorator will do just fine. It'll "bracket" the execution of the entire scheduling process with a set of matching setUp and tearDown "book ends".

How to access the state of other computer processes in Java? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am beginning to write a basic "study-buddy" program as a side project. One important feature I want to implement is that the program can access the state of other programs running to prevent you from accessing them / yell at you. For instance, if you had Chrome open to Facebook, or if you launched a video game.
First off, is this even possible/reasonable to accomplish in Java? Second, specifically with Chrome, how can I access the programs state from another program that I am writing? More generally, how can I access ALL programs running on the computer and check to see whether anything violates "study-permissible" programs?
I would put this as a comment, but my reputation point is not enough.
One way is using the commands the operating system provides. You can run a command with
Runtime.getRuntime().exec("<command name>");
This will give you the related process and you can get the output of that process just as manually running the process. Then, you can utilize the output.
Basically if the OS provides you that information manually, you should be able to get the information within Java.

Website with Java algorithms embedded into the site [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Hi I want to create a small web application which will take inputs such as 80 and 120 and return the GCD of those numbers. I want to write the logic in Java. When the user enters 80 and 120 and clicks on calculate button, the values must be passed to the algorithm and return the answer to be displayed on the application again. How do I link the java algorithm to the html page in order to achieve this? Kindly suggest. Is there no other way of doing this other than creating a Java applet for this and deploying it on the application? Kindly help.
Use "Applets" if you want the Java code to run in the users browser and not on a remote server.
Applets are, however, a waning technology due to the numerous attacks that has gone through the JVM to avoid the security checks in the browser, so your users will most likely not see the experience you want them to. Additionally I believe that the ability for the Java program to interact with its surrounding page has been crippled again for security reasons.
Your best bet is to use Java for server side code only (which it is quite fine for - Google Application Engine is perhaps the easiest way to get started) and to use JavaScript for client side code.

Can we make a JSF Application be a Web Service Server? And if it is possible, how is this actually done? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am new to JSF and, I need to make my JSF Application to be a web service server. Is this possible? And, if it is, can you please help me how to do it?
(Please keep in mind that this is a BAD IDEA anyway, so the answer will look like one as well)
Create a form with JSF. As soon as it works as expected use your second web app to GET the form HTML code, parse it and POST your parameters with the form.
If you created your JSF form well enough it will be sufficiently consistent that you can skip the GET and directly use the POST.
You could also use some third-party library to do the parsing and filling of the form for you. (But that does not make the idea any better)
Before you do that read about RESTful, JSON and most importanly Servlet. What they do, when to use them and realize that your approach is most likely not going to produce good, reliable, maintainable code.
DON'T DO IT THIS WAY (Unless you really REALLY understood what you are doing there)

Categories

Resources