Selenium Certification Training | Anagha | 11th Jan

Discussion in 'Agile and Scrum' started by Support Simplilearn(4685), Jan 10, 2020.

  1. Support Simplilearn(4685)

    Support Simplilearn(4685) Well-Known Member
    Alumni

    Joined:
    Feb 11, 2010
    Messages:
    99
    Likes Received:
    0
    Hi All,

    This is the common group for the batch participants to post their queries regarding course-related issues.

    Thanks,
    Simplilearn
     
    #1
  2. Anagha Gadgil

    Anagha Gadgil Well-Known Member

    Joined:
    Mar 18, 2019
    Messages:
    221
    Likes Received:
    26
  3. Anagha Gadgil

    Anagha Gadgil Well-Known Member

    Joined:
    Mar 18, 2019
    Messages:
    221
    Likes Received:
    26
  4. Anagha Gadgil

    Anagha Gadgil Well-Known Member

    Joined:
    Mar 18, 2019
    Messages:
    221
    Likes Received:
    26
    Assignment for Day -1 :
    Scanner object assignment :

    Use the addition program, accept numbers from users and perfrom

    Add, subtract, multiple and display the results.

    Create separate methods for each operation

    Accept a string from user and display the string

    Format your code : ctrl+a. : Select all code. Ctrl+shift+f
     
    #4
    Brinda Gyawali Poudel likes this.
  5. Sarath Mutyapu

    Joined:
    Dec 13, 2019
    Messages:
    2
    Likes Received:
    0
    After completing the assignment, is there a place to submit the work?


     
    #5
  6. Brinda Gyawali Poudel

    Joined:
    Dec 29, 2019
    Messages:
    1
    Likes Received:
    0
     

    Attached Files:

    #6
  7. Sridhar Raju Arramaraju

    Joined:
    Dec 17, 2019
    Messages:
    5
    Likes Received:
    1
    Hi, Here is the assignment : com.zip
     

    Attached Files:

    • com.zip
      File size:
      2.4 KB
      Views:
      3
    #7
  8. Sarath Mutyapu

    Joined:
    Dec 13, 2019
    Messages:
    2
    Likes Received:
    0
    First Java Basic Program Code.
     

    Attached Files:

    #8
  9. Leilanie Mendoza

    Joined:
    Nov 30, 2019
    Messages:
    3
    Likes Received:
    0
     

    Attached Files:

    #9
  10. Leilanie Mendoza

    Joined:
    Nov 30, 2019
    Messages:
    3
    Likes Received:
    0
    Submitting Assignment 2 - Constructor
     

    Attached Files:

    #10
  11. Christopher Garrison

    Christopher Garrison Active Member

    Joined:
    Oct 28, 2019
    Messages:
    15
    Likes Received:
    2
     

    Attached Files:

    #11
  12. Christopher Garrison

    Christopher Garrison Active Member

    Joined:
    Oct 28, 2019
    Messages:
    15
    Likes Received:
    2
    where are the code samples and notes from Jan 2020 day 2 Selenium posted?
     
    #12
  13. Anagha Gadgil

    Anagha Gadgil Well-Known Member

    Joined:
    Mar 18, 2019
    Messages:
    221
    Likes Received:
    26
  14. Gopal K Maheshwari

    Joined:
    Nov 12, 2019
    Messages:
    4
    Likes Received:
    0
    =============================================================================
    Assignment from Gopal M [artistinme03]
    Please find the attached Java file.
     

    Attached Files:

    #14
  15. Gopal K Maheshwari

    Joined:
    Nov 12, 2019
    Messages:
    4
    Likes Received:
    0
    Hey, My message is not yet posted on the wall and it says waiting for moderator approval from last 2 days.
     
    #15
  16. Aparna Mitra

    Aparna Mitra Member

    Joined:
    Sep 10, 2019
    Messages:
    6
    Likes Received:
    2
    Hi Anagha Ma'am,

    I read the below in one of the websites and needed some clarity.
    'Selenium browser classes (FirefoxDriver, ChromeDriver) have param and no-param constructors so this makes that there is no default constructor present in selenium.'

    Isnt default constructor same as no-param constructor ?
    So when I call the below - >
    //chrome
    new ChromeDriver() ----- is this default or no-param constructor ?
    new ChromeDriver(Capabilities desiredCapabilities)
    new ChromeDriver(ChromeOptions options)
     
    #16
  17. Aparna Mitra

    Aparna Mitra Member

    Joined:
    Sep 10, 2019
    Messages:
    6
    Likes Received:
    2
    I stumbled across a code and couldn't quite understand the steps in the constructor. Request you to share some understanding. Thanks.

    public abstract class TNGDriver {
    public static WebDriver driver;
    private static String chromeDriverPath = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chromedriver.exe";

    @SuppressWarnings("deprecation")
    public TNGDriver() {
    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
    ChromeOptions options = new ChromeOptions();
    options.addArguments("--incognito");
    capabilities.setCapability(ChromeOptions.CAPABILITY, options);
    System.setProperty("webdriver.chrome.driver", chromeDriverPath);
    driver = new ChromeDriver(capabilities);
    driver.manage().window().maximize();
    }

    public static WebDriver getDriver() {
    return driver;
    }

    public static void setDriver(WebDriver driver) {
    TNGDriver.driver = driver;
    }
     
    #17
  18. Sridhar Raju Arramaraju

    Joined:
    Dec 17, 2019
    Messages:
    5
    Likes Received:
    1
    Hi all,
    Can any one provide a link from where I can download the <internet explorer 11> web driver for windows 10? Appreciated your help.
     
    #18
  19. Christopher Garrison

    Christopher Garrison Active Member

    Joined:
    Oct 28, 2019
    Messages:
    15
    Likes Received:
    2
    Hi - Here is my 2nd Assignment concerning using a non parameter and parameter constructor.
     

    Attached Files:

    #19
  20. Anagha Gadgil

    Anagha Gadgil Well-Known Member

    Joined:
    Mar 18, 2019
    Messages:
    221
    Likes Received:
    26

    No param constructor is one where in there is a explicit constructor written like in this case, chromedriver() has a code written in its constructor.
    Default constructor is one which JVM calls itself when no explicit constructor is defined. And this enables initialisations of instance variables.

    Sometimes default name is used for both.
     
    #20
  21. Anagha Gadgil

    Anagha Gadgil Well-Known Member

    Joined:
    Mar 18, 2019
    Messages:
    221
    Likes Received:
    26

    In this code , whenever this class gets instantiated , chrome browser is launched. Now there are many options/capabilities you can set with the browser when we launch the browser. We will be looking at the browser capabilities much later in the course.
    So instead of calling a separate method for launching browser, driver initialisation and browser launch is done in constructor.
     
    #21
  22. Sridhar Raju Arramaraju

    Joined:
    Dec 17, 2019
    Messages:
    5
    Likes Received:
    1
    Hi, I am attaching the Constructor with and without parameter. Also, attaching to launch a browser on user choice using Chrome, Firefox and Edge, but I am unable to find out the IE 11 browser driver compatible with Windows 10. Hope i will find it soon, then update my code and upload again.
     

    Attached Files:

    #22
  23. Christopher Garrison

    Christopher Garrison Active Member

    Joined:
    Oct 28, 2019
    Messages:
    15
    Likes Received:
    2
    selenium-my place of work and my favorite hobby
     

    Attached Files:

    #23
  24. Anagha Gadgil

    Anagha Gadgil Well-Known Member

    Joined:
    Mar 18, 2019
    Messages:
    221
    Likes Received:
    26
    Here is the link .
    https://selenium-release.storage.googleapis.com/index.html?path=3.141/

    Also refer to this link on how to configure IE
    https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver#required-configuration
     
    #24
  25. Sankar Ammu

    Sankar Ammu Member

    Joined:
    Dec 8, 2019
    Messages:
    2
    Likes Received:
    0
    Hi,
    Attaching the Assignment for constructor with and with out parameters and launching the browsers (IE,Chrome & Firefox).
     

    Attached Files:

    #25
  26. Gopal K Maheshwari

    Joined:
    Nov 12, 2019
    Messages:
    4
    Likes Received:
    0
    Hi,
    Attached is the Code files for Basic Math, Constructor and BrowserLaunchAndNavigation assignment for Week 1 Assignment.
     

    Attached Files:

    #26
  27. Leilanie Mendoza

    Joined:
    Nov 30, 2019
    Messages:
    3
    Likes Received:
    0
    Submitting Assignment 3 & 4
     

    Attached Files:

    #27
  28. Anagha Gadgil

    Anagha Gadgil Well-Known Member

    Joined:
    Mar 18, 2019
    Messages:
    221
    Likes Received:
    26
    #28
    Christopher Garrison likes this.
  29. Sridhar Raju Arramaraju

    Joined:
    Dec 17, 2019
    Messages:
    5
    Likes Received:
    1
    #29
  30. Rashmi_86

    Rashmi_86 Active Member

    Joined:
    Jun 7, 2019
    Messages:
    24
    Likes Received:
    4
    Submitting -
    1. Day1_Assignment (Accept, Add, Subtract, Multiply, Display)
    2. Day2_Assignment_Contructors ( Default and Parameterized constructors)
     

    Attached Files:

    #30
  31. Christopher Garrison

    Christopher Garrison Active Member

    Joined:
    Oct 28, 2019
    Messages:
    15
    Likes Received:
    2
    hw for abstract class. looking forward to saturday. logged into project website and navigated through pages
     

    Attached Files:

    #31
  32. Rashmi_86

    Rashmi_86 Active Member

    Joined:
    Jun 7, 2019
    Messages:
    24
    Likes Received:
    4
    #32
  33. Sankar Ammu

    Sankar Ammu Member

    Joined:
    Dec 8, 2019
    Messages:
    2
    Likes Received:
    0
    Hi,
    Attaching day 3 assignment.
     

    Attached Files:

    #33
  34. Anagha Gadgil

    Anagha Gadgil Well-Known Member

    Joined:
    Mar 18, 2019
    Messages:
    221
    Likes Received:
    26
    #34
  35. Anagha Gadgil

    Anagha Gadgil Well-Known Member

    Joined:
    Mar 18, 2019
    Messages:
    221
    Likes Received:
    26
  36. Sridhar Raju Arramaraju

    Joined:
    Dec 17, 2019
    Messages:
    5
    Likes Received:
    1
    Hi Rashmi,
    I would suggest that based on your OS you choose the IE web driver, like if it is 32 bit / 64 bit etc. Also follow the steps provided by Anagha which are straight forward. Hope this helps...
     
    #36
    Rashmi_86 likes this.
  37. Rashmi_86

    Rashmi_86 Active Member

    Joined:
    Jun 7, 2019
    Messages:
    24
    Likes Received:
    4
    Thanks
     
    #37
  38. Rashmi_86

    Rashmi_86 Active Member

    Joined:
    Jun 7, 2019
    Messages:
    24
    Likes Received:
    4
    Submitting Day6_Assignment (TestNG testcase to launch browser, launch FB page, login using parameters for browser, username and password from .xml file) -

    .java file -

    package practicePackage;
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.chrome.ChromeDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.testng.annotations.Parameters;
    import org.testng.annotations.Test;
    public class Day6_Assignment_Parameters {
    WebDriver driver;
    @Test(priority = 0)
    @Parameters({"browserName"})
    public void launchBrowser(String browserName) {
    if (browserName.equalsIgnoreCase("firefox")) {
    System.setProperty("webdriver.gecko.driver", "./drivers/geckodriver.exe");
    driver = new FirefoxDriver();
    } else if (browserName.equalsIgnoreCase("chrome")) {
    System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe");
    driver = new ChromeDriver();
    }
    }
    @Test(priority = 1, dependsOnMethods = { "launchBrowser" })
    @Parameters({"username", "password"})
    public void fblogin(String username, String password) {
    driver.get("https://www.facebook.com/");
    driver.findElement(By.id("email")).sendKeys(username);
    driver.findElement(By.id("pass")).sendKeys(password);
    driver.findElement(By.xpath("//input[@value='Log In']")).click();
    System.out.println("User clicked on Login");
    }

    }

    .xml File -
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
    <suite name="Suite">
    <test thread-count="5" name="Test">
    <parameter name="browserName" value="chrome"></parameter>
    <parameter name="username" value="User_2"></parameter>
    <parameter name="password" value="pass_2"></parameter>
    <classes>
    <class name="practicePackage.Day6_Assignment_Parameters"/>
    </classes>
    </test> <!-- Test -->
    </suite> <!-- Suite -->
     
    #38
  39. Rashmi_86

    Rashmi_86 Active Member

    Joined:
    Jun 7, 2019
    Messages:
    24
    Likes Received:
    4
    Can anyone help to find xpath of 'First name' on the 'Create an Account' page of our Project?
    (http://automationpractice.com/index.php?controller=authentication&back=my-account#account-creation)

    My test is failing because it is Unable to locate the element. So far I have tried these locators but none of them is working -

    driver.findElement(By.id("customer_firstname")).sendKeys("Rashmi");

    driver.findElement(By.xpath("//input[@id='customer_firstname']")).sendKeys("Rashmi");

    driver.findElement(By.xpath("//form[@id='account-creation_form']/div/div[2]/input']")).sendKeys("Rashmi");
     
    #39
  40. Anagha Gadgil

    Anagha Gadgil Well-Known Member

    Joined:
    Mar 18, 2019
    Messages:
    221
    Likes Received:
    26

    Check if the element is loaded. You can try giving thread.sleep before locating the element.
     
    #40
  41. Rashmi_86

    Rashmi_86 Active Member

    Joined:
    Jun 7, 2019
    Messages:
    24
    Likes Received:
    4
    Thanks! It worked with Thread.sleep(3000)
     
    #41
  42. Anagha Gadgil

    Anagha Gadgil Well-Known Member

    Joined:
    Mar 18, 2019
    Messages:
    221
    Likes Received:
    26
    #42
  43. Aparna Mitra

    Aparna Mitra Member

    Joined:
    Sep 10, 2019
    Messages:
    6
    Likes Received:
    2
    In your last class for Maven, you mentioned GroupID is the project name and then you said ArtifactID is the project name.
    When I created the maven project I see artifactid being picked up as my project name and for Package there is a separate field.
    So where is this GroupID value reflecting and what is its importance or what does it do ?
    Also, it would be helpful if you could shared the difference bet the two - GroupID and ArtifactID.
     
    #43
  44. J.Bhagyalakshmi

    Alumni

    Joined:
    Jan 6, 2020
    Messages:
    4
    Likes Received:
    0
    Hi Anagha, I'm not able to locate elements for Gender, First Name, Last Name.on the 'Create an Account' page of our Project.
     
    #44
  45. Anagha Gadgil

    Anagha Gadgil Well-Known Member

    Joined:
    Mar 18, 2019
    Messages:
    221
    Likes Received:
    26

    GroupID : This is for creating a Organisation level project name
    ActifactID.: The project name which you want to create for your project.

    Example : GroupID : FinanceDept. ArtifactID : BudgetApplication
     
    #45
  46. J.Bhagyalakshmi

    Alumni

    Joined:
    Jan 6, 2020
    Messages:
    4
    Likes Received:
    0
    Hi Anagha, I'm not able to locate elements for Gender, First Name, Last Name.on the 'Create an Account' page of our Project.
     
    #46
  47. Mamatha_18

    Mamatha_18 Member

    Joined:
    Jan 11, 2020
    Messages:
    2
    Likes Received:
    0
     
    #47
  48. Mamatha_18

    Mamatha_18 Member

    Joined:
    Jan 11, 2020
    Messages:
    2
    Likes Received:
    0
    package com.HomeWork;

    import java.util.Scanner;

    public class AssignmentAddSubMulti {

    public int addNumbers(int x, int y) {
    return (x + y);
    }

    public int subNumbers(int x, int y) {
    return (x - y);
    }

    public int multiNumbers(int x, int y) {
    return (x * y);
    }

    public static void main(String[] args) {
    Scanner objstring = new Scanner(System.in);
    System.out.println("Enter User String");
    String username = objstring.nextLine();
    System.out.println("Hello " + username);

    objstring = new Scanner(System.in);
    System.out.println("Enter NUmber1 ");
    int number1 = objstring.nextInt();

    objstring = new Scanner(System.in);
    System.out.println("Enter NUmber2 ");
    int number2 = objstring.nextInt();

    AssignmentAddSubMulti objmath = new AssignmentAddSubMulti();
    int numaddition = objmath.addNumbers(number1, number2);
    System.out.println("addition of " + number1 + " + " + number2 + " = " + numaddition);
    int numsubtraction = objmath.subNumbers(number1, number2);
    System.out.println("sub of " + number1 + " - " + number2 + " = " + numsubtraction);
    int nummultiplication = objmath.multiNumbers(number1, number2);
    System.out.println("multiply of " + number1 + " * " + number2 + " = " + nummultiplication);

    }

    }
     
    #48
  49. Rashmi_86

    Rashmi_86 Active Member

    Joined:
    Jun 7, 2019
    Messages:
    24
    Likes Received:
    4
    I have the following scenarios working, but each of them is in a separate class file. I am having a hard time converting it to POM -

    upload_2020-2-7_14-39-36.png

    1. There should be one file to find all elements or each page involved will have its own page file?

    2. I have 5 Tests.java files to cover my scenarios as shown in the above table, should each test launch browser and run independently or each test should start from the page where the previous test ended? Then each test will depend on the previous test?

    3. My tests have some asserts in between the steps also. how can I separate the code for page.java file and Tests.java file?
     

    Attached Files:

    #49
  50. Anagha Gadgil

    Anagha Gadgil Well-Known Member

    Joined:
    Mar 18, 2019
    Messages:
    221
    Likes Received:
    26


    Looks very neat.

    1.For page class, you can create one page class for each of your pages. Also you can consider clubbing few pages together if they are pretty small pages with very few web elements. This will have all your webelements and its operation
    2. You can have one or two java files created for your 5 tests. Add 3 tests to one and 2 tests to other. Or you could also have single java files where you have all your 5 test cases. Each of this test case will be in @Test.
    3. Launch browser : Write a utility as I have shown, and just call this in your test class under @BeforeTest
    4. For common pages which you need to use across tests, do the page factory.initelements in @BeforeTest
    5.For the pages which are specific to the test, do the page factory.init in its test in @Test
    6.All your asserts will be part of @Test only in your test class. Assert will not be in page class. page class contains only WebElement operation like click, sendkeys.

    Are you referring to the FB login test case we created using POM? If not, please refer to that.
     
    #50

Share This Page