Ask Experts Questions for FREE Help !
Ask
    shreyas007's Avatar
    shreyas007 Posts: 1, Reputation: 1
    New Member
     
    #1

    Aug 26, 2015, 10:44 AM
    How to invoke the variables from first class and second class to third class in java
    I need to invoke the class1 and class2 variable to class3.
    class1 and class2 contain only variable , no methods.

    I am not able execute my program.

    My code contain some selenium scripts also

    My code as follows

    package TestObjects;


    import org.openqa.selenium.By;


    public class class1 {





    public By username=By.xpath(".//*[@id='username']");

    public By password=By.xpath(".//*[@id='password']");

    public By signinbutton=By.xpath(".//*[@id='sign-in-button']");



    }




    package TestObjects;


    import org.openqa.selenium.By;






    public class class2 {

    public By myaccountdropdown=By.xpath(".//*[@id='homepage']/nav/ul/li[8]/div[1]/span[3]");

    public By signin=By.xpath(".//*[@id='homepage']/nav/ul/li[8]/div[2]/div[1]/div[1]/button");


    }




    package Pages;


    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;


    import TestObjects.HomePage_Locators;
    import TestObjects.LoginPage_Locators;




    public class class3 {
    public WebDriver driver;

    public void account_signin()

    {
    class1 obj1=new class1();
    class2 obj2=new class2();



    driver.findElement(myaccountdropdown).click();

    driver.findElement(signin).click();

    driver.findElement(username).sendKeys("nousername" );

    driver.findElement(password).sendKeys("nopassword" );

    driver.findElement(signinbutton).click();

    }






    }

Check out some similar questions!

Class boundaries,class width,class mid-point [ 0 Answers ]

Find the class width of the following, 3-7 8-10 11-15 16-18 19-25.

2 class 4 use of a wire and class 6 possession of a forgery device [ 3 Answers ]

Now I was arrested oct.9 2008 in az for the use of a wire, However I was paged 2. what that means is more charges. I only walked away with 2 felonies in that case , but I had got paged 2 twice only because they did not know who to charge with what, is all this on my arrest record, and do I have to...

Construct a table for class,freq, midpoint,class boundary,relative req,and cumulati [ 1 Answers ]

Construct a table for class,freq, midpoint,class boundary,relative req,and cumulative freg? Number of classes:5 Data set:35,32,51,39,44,41,42,38,37,42,38,39,36,40,39,46,44,37,43,35,40,41,40,39

What level or class felony is poss/w intent to distribute class d [ 3 Answers ]

In criminal law is possession with intent to distribute class d "one gram " a major or minor felony? I have this on my record because in mass there was no limit to be charged this way But now it is a civil offence no longer a crime.now that mass law is changed when it comes to marijauna will my...


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.