1. Introduction (1)
    1. introduction about automation
      1. What is the automation testing?
      2. Advantage or benefit of automation testing
      3. Disadvantages of automation Testing
    2. OOP and Java Intro
      1. Prepare Enviroments
        1. Needed apps
          1. Jdk
          2. NodeJS
          3. InteliJ
          4. \\dev-rack2\Automation Testing Martials
      2. What is OOP
        1. OOP means Object Oriented Programming
        2. OOP concepts are intended to improve code readability , reusability and maintainability by defining how to structure your program efficiently.
      3. What is Java
        1. Java is a class-based object-oriented programming (OOP) language built around the concept of objects.
        2. Class\Object
          1. Definition
          2. its like packages of functions and parameters(attributes) to be readable and reusable on many places
          3. Example
          4. Modifiers
          5. Is keywords which used to define the scope of my class \ method and attributes
          6. Methods
          7. A method is a block of code which only runs when it is called.
          8. You can pass data, known as parameters, into a method.
          9. Methods are used to perform certain actions, and they are also known as functions.
          10. Why use methods? To reuse code: define the code once, and use it many times.
          11. Main method
          12. The Java compiler or JVM looks for the main method when it starts executing a Java program. The signature of the main method needs to be in a specific way for the JVM to recognize that method as its entry point. If we change the signature of the method, the program compiles but does not execute.
          13. Example
          14. Constructor
          15. A constructor in Java is a special method that is used to initialize objects. The constructor is called when an object of a class is created.
          16. Its look like connection panel between classes should i call you on Vodafone or etisalat
          17. Example
          18. more examples on inteliJ + Methods overloading
          19. Java Variables
          20. Data types
          21. Primitive data types - includes byte, short, int, long, float, double, boolean and char
          22. int - stores integers (whole numbers), without decimals, such as 123 or -123
          23. float - stores floating point numbers, with decimals, such as 19.99 or -19.99
          24. char - stores single characters, such as 'a' or 'B'. Char values are surrounded by single quotes
          25. boolean - stores values with two states: true or false
          26. Non-primitive data types - such as String, Arrays and Classes (you will learn more about these in a later session)
          27. String - stores text, such as "Hello". String values are surrounded by double quotes
          28. Size and Length
          29. Difference between primitive and non-primitive
          30. Primitive types are predefined (already defined) in Java. Non-primitive types are created by the programmer and is not defined by Java (except for String).
          31. Non-primitive types can be used to call methods to perform certain operations, while primitive types cannot.
          32. A primitive type has always a value, while non-primitive types can be null.
          33. A primitive type starts with a lowercase letter, while non-primitive types starts with an uppercase letter.
          34. The size of a primitive type depends on the data type, while non-primitive types have all the same size.
          35. Java Type Casting
          36. Widening Casting (automatically) - converting a smaller type to a larger type size byte -> short -> int -> long -> float -> double
          37. Narrowing Casting (manually) - converting a larger type to a smaller size type double -> float -> long -> int -> char -> short -> byte
          38. Identifiers
          39. All Java variables must be identified with unique names.
          40. Names can contain letters, digits, underscores, and dollar signs
          41. Names must begin with a letter
          42. Names should start with a lowercase letter and it cannot contain whitespace
          43. Names can also begin with $ and _ (but we will not use it in this tutorial)
          44. Names are case sensitive ("myVar" and "myvar" are different variables)
          45. Reserved words (like Java keywords, such as int or boolean) cannot be used as names
          46. Declare Multiple Variables
          47. Single declaration
          48. Multi-declaration
          49. Multi-declaration and initialization
          50. Operators
          51. Arithmetic operators are used to perform common mathematical operations.
          52. A list of all assignment operators
          53. https://www.javatpoint.com/operators-in-java
          54. Java Comparison Operators
          55. Java Logical Operators (true / false)
    3. Task
      1. Please Build a Java program which can
        1. Store Internships details with names ,ages ,department details and grade of intern / Store Employees details with their names ,ages ,department details and level of experience
          1. Note that: You shouldn't duplicate code
        2. Interns want to be able to enter name of their job title (IT - Developer - Tester ...etc)
        3. Interns want to be able to know their grade (default to be passed)
  2. Java & OOP (1)
    1. The main principles of OOP
      1. 1. Abstraction
        1. Definition
          1. Data abstraction is the process of hiding certain details and showing only essential information to the user. Abstraction can be achieved with either abstract classes or interfaces
        2. Abstract class
          1. it is a restricted class that cannot be used to create objects (to access it, it must be inherited from another class).
        3. Abstract method
          1. can only be used in an abstract class/interfaces, and it does not have a body. The body is provided by the subclass (inherited from).
        4. Example
      2. 2. Encapsulation
        1. Definition
          1. Encapsulation helps with data security (hiding), allowing you to protect the data stored in a class from system-wide access.
        2. Example
      3. 3. Inheritance
        1. Definition
          1. Inheritance makes it possible to create a child class that inherits the fields and methods of the parent class.
          2. The child class can override the values and methods of the parent class, but it’s not necessary.
          3. It can also add new data and functionality to its parent.
          4. Parent classes are also called super classes or base classes, while child classes are known as subclasses or derived classes as well. Java uses the extends keyword to implement the principle of inheritance in code.
        2. Example
        3. Multi-inheritance
          1. difference between classes and interfaces
          2. abstract vs interface
          3. Example
      4. 4. Polymorphism
        1. Definition
          1. Polymorphism refers to the ability to perform a certain action in different ways. In Java, polymorphism can take two forms: method overloading and method overriding.
        2. Example
    2. Java Packages & API
      1. A package in Java is used to group related classes. Think of it as a folder in a file directory. We use packages to avoid name conflicts, and to write a better maintainable code. Packages are divided into two categories:
        1. Built-in Packages (packages from the Java API)
          1. The Java API is a library of prewritten classes, that are free to use, included in the Java Development Environment.
          2. The library contains components for managing input, database programming, and much much more. The complete list can be found at Oracles website: https://docs.oracle.com/javase/8/docs/api/.
          3. The library is divided into packages and classes. Meaning you can either import a single class (along with its methods and attributes), or a whole package that contain all the classes that belong to the specified package.
          4. To use a class or a package from the library, you need to use the import keyword
          5. Example
        2. User-defined Packages (create your own packages)
          1. Shaft engine
          2. Selenium
          3. testng
    3. Java User Input (Scanner)
      1. The Scanner class is used to get user input, and it is found in the java.util package.
      2. To use the Scanner class, create an object of the class and use any of the available methods found in the Scanner class documentation.
      3. Control Entry data types
        1. Input Types
      4. Example
        1. Can use it in previous task to get data from user
        2. Can build get method to get user data which needed
    4. Access and non-access modifiers
      1. Final
        1. Can't initialize the variable after it
    5. Java Scope
      1. Scope of parameters in method
      2. in block {int x}
    6. String Data type
      1. A String variable contains a collection of characters surrounded by double quotes
      2. Java String Concatenation
        1. The + operator can be used between strings to combine them. This is called concatenation
      3. Strings - Special Characters
        1. Special char inside string
        2. Commands
      4. on intelliJ
    7. Java Conditions
      1. If..else
        1. Normal Use of If.. else
          1. Use if to specify a block of code to be executed, if a specified condition is true
          2. Use else to specify a block of code to be executed, if the same condition is false
          3. else IF
          4. Use else if to specify a new condition to test, if the first condition is false
          5. Example
        2. Short Hand If...Else
          1. short-hand if else, which is known as the ternary operator because it consists of three operands.
          2. (condition) ? expressionTrue : expressionFalse
          3. Example
    8. Task
      1. Enhance your old task to be more customized
        1. All duplicated to be centralized
      2. read from user to make sure he is intern or Employee then continue the program depends on what he enter
        1. add person details to be from cusromer
      3. Add department to you program
        1. Department name (String accept full name)
        2. Department description
          1. String accept to 200 char
        3. Department number of members (incrementable)
          1. Integer
      4. Add new function to interns to be able to add self study courses
        1. Course name
        2. Link of certificate
      5. File name to be like (Name_S2_Task)
  3. Java (2)
    1. Java Switch
      1. Use switch to specify many alternative blocks of code to be executed
        1. Instead of writing many if..else statements, you can use the switch statement.
      2. Example
    2. Arrays of data
      1. Static Array
        1. Arrays are used to store multiple values in a single variable, instead of declaring separate variables for each value.
        2. To declare an array, define the variable type with square brackets: - String[] cars;
        3. ex
      2. Array list
        1. The ArrayList class is a resizable array, which can be found in the java.util package.
        2. The difference between a built-in array and an ArrayList in Java, is that the size of an array cannot be modified (if you want to add or remove elements to/from an array, you have to create a new one). While elements can be added and removed from an ArrayList whenever you want. The syntax is also slightly different
        3. ex
      3. Linked list (Right bar of Twix)
        1. The LinkedList class is a collection which can contain many objects of the same type, just like the ArrayList.
        2. The LinkedList class has all of the same methods as the ArrayList class because they both implement the List interface. This means that you can add items, change items, remove items and clear the list in the same way.
        3. However, while the ArrayList class and the LinkedList class can be used in the same way, they are built very differently.
        4. ex
    3. Java File Handling
      1. Java Files
        1. The File class from the java.io package, allows us to work with files.
        2. To use the File class, create an object of the class, and specify the filename or directory name
        3. ex
        4. functions
      2. Java Create and Write To Files
        1. ex
      3. Java Read Files
        1. Read the data inside the file
        2. Read file details
        3. Subtopic 3
      4. Java Delete Files
        1. Delete file
        2. Delete directory
    4. Java Enums
      1. An enum is a special "class" that represents a group of constants (unchangeable variables, like final variables).
        1. Used to avoid case sensitive issues
      2. Example
    5. Java Math
    6. Java Dates
      1. Java does not have a built-in Date class, but we can import the java.time package to work with the date and time API. The package includes many date and time classes. For example:
        1. LocalDate -> Represents a date (year, month, day (yyyy-MM-dd))
        2. LocalTime -> Represents a time (hour, minute, second and nanoseconds (HH-mm-ss-ns))
        3. LocalDateTime -> Represents both a date and a time (yyyy-MM-dd-HH-mm-ss-ns)
        4. DateTimeFormatter -> Formatter for displaying and parsing date-time objects
      2. Date/Time formatter
        1. Patternof()
      3. Example
    7. Exceptions and Exception handler
      1. When executing Java code, different errors can occur: coding errors made by the programmer, errors due to wrong input, or other unforeseeable things.
      2. When an error occurs, Java will normally stop and generate an error message. The technical term for this is: Java will throw an exception (throw an error).
      3. Finally method
        1. The finally statement lets you execute code, after try...catch
      4. Example
    8. Loops
      1. Definition
        1. Loops can execute a block of code as long as a specified condition is reached.
        2. Loops are handy because they save time, reduce errors, and they make code more readable.
        3. loops through a block of code as long as a specified condition is true
      2. Types
        1. While loop
          1. Example
          2. ++ differences
        2. The Do/While Loop
          1. Example
        3. For loop
          1. Normal loop
          2. Example
          3. Nested Loops
          4. Definition
          5. It is also possible to place a loop inside another loop. This is called a nested loop.
          6. The "inner loop" will be executed one time for each iteration of the "outer loop"
          7. Example
    9. Java Break and Continue
      1. Break (stop)
        1. You have already seen the break statement used in an earlier chapter of this tutorial. It was used to "jump out" of a switch statement.
        2. The break statement can also be used to jump out of a loop.
        3. Ex
      2. Continue (Skip)
        1. The continue statement breaks one iteration (in the loop), if a specified condition occurs, and continues with the next iteration in the loop.
        2. Ex
  4. Workshop Java
    1. Manage scanners using Enums
    2. Manage scanners for intern or employees
      1. manage how much employee should be in
    3. handle exception if enter wrong data type in any feild
    4. Encapsulation
      1. setter
      2. getter
    5. inhretance
      1. interface
    6. polymorphism
      1. override func
    7. Loop to enter how many users to system
      1. continue if name = mohanad
      2. break if name = ashraf
    8. Conditions on function if intern or employee
      1. if else
      2. switch case
  5. Selenium (1)
    1. Selenium introduction & automation basics
      1. Maven
        1. Maven is a built automation tool from Apache Software Foundation and is commonly used to handle Java projects. Initially, it was developed to simplify the build process of the Jakarta Turbine Project. Nowadays, it is widely used to manage project dependencies and the whole lifecycle of any project.
    2. Selenium libraries and dependences
    3. Drivers
      1. Types
        1. WebDriver
          1. Contact with web data and also can read some mobile data
        2. AppiumDriver
          1. Contact with mobile data
      2. starts and close
      3. Capabilities
    4. Different Types of Locators in Selenium
      1. By CSS ID: find_element_by_id
        1. find_element(By.ID, "id")
      2. By CSS class name: find_element_by_class_name
        1. find_element(By.CLASS_NAME, "class name")
          1. driver.find_elements(By.CLASS_NAME, 'my-css-class')
      3. By name attribute: find_element_by_name
        1. find_element(By.NAME, "name")
          1. Ex.
          2. By.Name
      4. By DOM structure or Xpath: find_element_by_xpath
        1. find_element(By.XPATH, "xpath")
          1. helps in locating elements on the web page using XML expressions. The basic syntax used for using XPath as a CSS locator in Selenium WebDriver is shown
          2. Standard XPath
          3. XPath: //tagname[@attribute = 'value']
          4. email_input = driver.find_element_by_xpath("//form[input/@name='email']")
          5. //tagname[contains(@attribute, ‘partial value of attribute’)]
          6. driver.findElement(By.xpath("//input[contains(@class, ‘form-control’)]"))
          7. XPath using ‘AND’ & ‘OR’
          8. driver.findElement(By.xpath("//input[@type='email' OR @name='email']"));
          9. driver.findElement(By.xpath("//input[@type='email' AND @name='email']"
          10. starts-with() method in XPath
          11. driver.findElement(By.xpath("//input[starts-with(@name,'pass')]"));
          12. XPath Text
          13. driver.findElement(By.xpath("//button[text()='Free Sign Up']"));
          14. Xpath Index
          15. first_name = driver.find_element_by_xpath("//form[@id='loginForm']/input[1]") last_name = driver.find_element_by_xpath("//form[@id='loginForm']/input[2]")
      5. by tagName: find_element_by_tag_name()
        1. find_element(By.TAG_NAME, "tag name")
          1. page_heading = driver.find_element_by_tag_name('h1')
      6. By link text: find_element_by_link_text
        1. find_element(By.LINK_TEXT, "link text")
          1. The <a> tag defines a hyperlink so we can also search for a hyperlink element using the link text. One can either use the .find_element_by_link_text() method to search for the exact link’s text.
          2. <a href="https://www.lambdatest.com/automation-testing" class="desktop:block desktop:ml-0 desktop:mt-10 nav-link inline-block py-5 text-size-14 font-medium ml-30 fromipad:ml-20 ">Automation</a>
          3. # Exact Link Text driver.findElement(By.linkText("Automation"));
      7. By partial link text: find_element_by_partial_link_text
        1. find_element(By.PARTIAL_LINK_TEXT, "partial link text")
          1. Or one can also search for a hyperlink element using the partial link text .find_element_by_partial_link_text() method to search for a partial text.
          2. # Partial Link Text click_here_link = driver.find_element_by_partial_link_text('Click')
      8. By CSS Selector: find_element_by_css_selector
        1. find_element(By.CSS_SELECTOR, "css selector")
          1. CSS used to style web pages. At the same time, CSS is also one of the widely-used ways to locate WebElements
          2. CSS Selector in Selenium should be opted if you cannot locate an element using ID or Name locators. It can be chosen over the XPath locator.
          3. Since multiple debates go around the corner for both of them, their usages for me depend on the complexity of the scenario. However, most people prefer using CSS selectors since those are faster than XPath.
    5. task
      1. 1- build a code which be able to login to https://gitlab.com/users/sign_in
      2. 2- Use different type of find elements
      3. 3- validate if login work successfully
      4. 4- select remember me
      5. 5- if not login open new tab with same link
      6. 6- press forget my password
      7. 7- back to first tab
  6. Selenium (2)
    1. Verification commands ( gettext , get... , isenabled ,isselected .....)
      1. Get text
      2. get attribute
      3. get css
      4. is enabled
      5. is displayed
      6. is selected
    2. Handle mouse movements and keyboard events
      1. Keyboard actions
      2. Mouse actions
    3. Switch alerts
      1. Alerts
        1. Alert types
          1. 1) Simple Alert
          2. The simple alert class in Selenium displays some information or warning on the screen.
          3. 2) Prompt Alert
          4. This Prompt Alert asks some input from the user and Selenium webdriver can enter the text using sendkeys(” input…. “).
          5. 3) Confirmation Alert
          6. This confirmation alert asks permission to do some type of operation.
        2. How to handle Alert in Selenium
          1. driver.switchTo().alert().
          2. features ex
      2. How to handle Pop-up window
        1. All opened window
          1. Driver.getWindowHandles();
          2. as we used at last session
        2. parent window
          1. Driver.getWindowHandle();
    4. Operate Calender
      1. How to Select Date from DatePicker/Calendar
        1. Send date and time to date field
        2. Select date at date picker
    5. Waits
      1. Impicit
        1. The Implicit Wait in Selenium is used to tell the web driver to wait for a certain amount of time before it throws a “No Such Element Exception”. The default setting is 0. Once we set the time, the web driver will wait for the element for that time before throwing an exception.
          1. driver.manage().timeouts().implicitlyWait(TimeOut, TimeUnit.SECONDS);
      2. Explicit
        1. The Explicit Wait in Selenium is used to tell the Web Driver to wait for certain conditions (Expected Conditions) or maximum time exceeded before throwing “ElementNotVisibleException” exception. It is an intelligent kind of wait, but it can be applied only for specified elements. It gives better options than implicit wait as it waits for dynamically loaded Ajax elements.
          1. WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3));
          2. wait.until(ExpectedConditions.elementToBeClickable(CountryBtn)).click();
        2. - alertIsPresent() - elementSelectionStateToBe() - elementToBeClickable() - elementToBeSelected() - frameToBeAvaliableAndSwitchToIt() - invisibilityOfTheElementLocated() - invisibilityOfElementWithText() - presenceOfAllElementsLocatedBy() - presenceOfElementLocated() - textToBePresentInElement() - textToBePresentInElementLocated() - textToBePresentInElementValue() - titleIs() - titleContains() - visibilityOf() - visibilityOfAllElements() - visibilityOfAllElementsLocatedBy() - visibilityOfElementLocated()
      3. Difference between implicit and explicit
      4. Thread Sleep
        1. Thread.sleep
          1. As per the official definition from the Oracle Java Documentation, Thread.sleep() causes the current thread to suspend execution for a specified period.
          2. Thread.sleep() is not a Selenium wait, it is provided by Java.
          3. It suspends the code for the specified time and can be useful in debugging the script under test.
  7. Framework
    1. Overview of framework
      1. POM
        1. What is Page Object Model
          1. Page Object Model (POM) is a design pattern, popularly used in test automation that creates Object Repository for web UI elements. The advantage of the model is that it reduces code duplication and improves test maintenance.
          2. Under this model, for each web page in the application, there should be a corresponding Page Class. This Page class will identify the WebElements of that web page and also contains Page methods which perform operations on those WebElements. Name of these methods should be given as per the task they are performing, i.e., if a loader is waiting for the payment gateway to appear
          3. ex
      2. Frameworks Types
        1. Data-Driven Framework
          1. Data Driven Framework in Selenium is a method of separating data sets from the test case. Once the data sets are separated from the test case, it can be easily modified for a specific functionality without changing the code. It is used to fetch test cases and suites from external files like Excel, .csv, .xml or some database tables.
          2. ex
          3. Json as FW
      3. Testng
        1. TestNG is a testing framework inspired from JUnit and NUnit but introducing some new functionalities that make it more powerful and easier to use.
        2. TestNG is an open source automated testing framework; where NG of TestNG means Next Generation. TestNG is similar to JUnit especiallyJUnit4, but its not a JUnit extension. Its inspired by JUnit. It is designed to be better than JUnit, especially when testing integrated classes. The creator of TestNG is Cedric Beust.
        3. Annotations.
          1. @BeforeSuite The annotated method will be run only once before all tests in this suite have run.
          2. @AfterSuite The annotated method will be run only once after all tests in this suite have run.
          3. @BeforeClass The annotated method will be run only once before the first test method in the current class is invoked.
          4. @AfterClass The annotated method will be run only once after all the test methods in the current class have been run.
          5. @BeforeTest The annotated method will be run before any test method belonging to the classes inside the <test> tag is run.
          6. @AfterTest The annotated method will be run after all the test methods belonging to the classes inside the <test> tag have run.
          7. @BeforeGroups The list of groups that this configuration method will run before. This method is guaranteed to run shortly before the first test method that belongs to any of these groups is invoked.
          8. @AfterGroups The list of groups that this configuration method will run after. This method is guaranteed to run shortly after the last test method that belongs to any of these groups is invoked.
          9. @BeforeMethod The annotated method will be run before each test method.
          10. @AfterMethod The annotated method will be run after each test method.
          11. @DataProvider Marks a method as supplying data for a test method. The annotated method must return an Object[][] where each Object[] can be assigned the parameter list of the test method. The @Test method that wants to receive data from this DataProvider needs to use a dataProvider name equals to the name of this annotation.
          12. @Factory Marks a method as a factory that returns objects that will be used by TestNG as Test classes. The method must return Object[].
          13. @Listeners Defines listeners on a test class.
          14. @Parameters Describes how to pass parameters to a @Test method.
          15. @Test Marks a class or a method as part of the test.
    2. session 8
      1. Testng ( Tags , Assert , XML , Reports)
        1. TestNG Features
          1. TestNG uses more Java and OO features.
          2. Supports testing integrated classes e. g. , bydefault, noneedtocreateanewtestclassinstanceforeverytestmethod.
          3. Separate compile-time test code from run-time configuration/data info.
          4. assert
          5. Flexible runtime configuration.
          6. Introduces ‘test groups’. Once you have compiled your tests, you can just ask TestNG to run
          7. all the "front-end" tests, or "fast", "slow", "database", etc...
          8. Supports Dependent test methods, parallel testing, load testing, partial failure.
          9. Flexible plug-in API.
          10. Support for multi threaded testing.
      2. Frameworks Types
        1. Linear Automation Framework
          1. normal pane code
        2. Modular Based Testing Framework
          1. modular as pom
        3. Library Architecture Testing Framework
          1. as pom with testng
        4. Data-Driven Framework
          1. with json
        5. Keyword-Driven Framework
          1. json with key
        6. Hybrid Testing Framework
          1. both
    3. session 9
      1. centralized functions
        1. Scroll \ Json reader
          1. Review
          2. Task
    4. session 10
      1. build a project from scratch
  8. Topics
    1. Algorithm
      1. https://youtube.com/playlist?list=PLwCMLs3sjOY6KH-8c9F-lMWn-r02hyoV_
    2. Data-Structure
      1. https://youtube.com/playlist?list=PLoK2Lr1miEm-5zCzKE8siQezj9rvQlnca
    3. Design pattern
      1. https://www.youtube.com/playlist?list=PLd-dOEgzBpGnt3GuEszo_piQq52XSqAmj
  9. Sessions
    1. IDE IntelJ
      1. https://testautomationu.applitools.com/intellij/
    2. OOP and Java
      1. https://testautomationu.applitools.com/java-programming-course/
        1. https://www.w3schools.com/java/
    3. Selenium Java
      1. https://testautomationu.applitools.com/selenium-webdriver-tutorial-java/
    4. Testng
      1. https://testautomationu.applitools.com/introduction-to-testng/