Question
Java programming language class Main { public static void main(String[] args) { // 1. Create a base class for a web elements - BaseElement //
Java programming language
class Main { public static void main(String[] args) {
// 1. Create a base class for a web elements - BaseElement // 2. Create two classes that inherit from the class above: LinkElement and TextElement // 3. Declare a string variable locator with a value "//*[id='some-id']", so it is in both classes (without duplicating the code) // 4. Implement one simple method click(), so it is in both classes (without duplicating the code) // 5. On a click there should be a message printed to the Console: "clicked on an element" // 6. The statement above is true for a text type of element - you can click on it but nothing will happen really // 7. At the same time when you click on a link - you usually get redirected to some other page, so in this case please print out: "clicked and redirected" // 8. It is a simplified version of a framework structure that we will cover in details when we start Selenium // 9. Now let's run it and see what is going to happen: // // declare both elements in Main class // print out both locators, what do you see? which principle is that? // call methods for both elements, which principle is that?
System.out.println("Assignment"); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started