I am working in automation using java language. I am following page object design .while executing , my code getting error…
In the BaseBallOutEvents class. I want to select a value from the drop down option. In winium select class is not supporting , so i used comboBox for selecting dropdown value. In that class in the method groundouttop1 method i used driver.findElement(By.name(velo)).click();otherwise it should not be able to click. now I am getting instantiation exception… anybody please help me…

package page;

public class BaseBallOutEvents {


    private WiniumDriver driver;
    public BaseBallOutEvents(WiniumDriver driver) {
        this.driver=driver;

        // TODO Auto-generated constructor stub
    }
@FindBy(how=How.ID,using="cmbVelocity")
    WebElement textVelocity;
    @FindBy(how=How.ID,using="DropDown")
    WebElement dropDown;
    public  void groundOuttop1(String field,String dist,String velo,String diff) throws InterruptedException {
        //TSBH


        groundOutButton.click();
        enterFielding.sendKeys(field);
        saveButton.click();
        textDistance.sendKeys(dist);
         dropDown.click();

        ComboBox cmbcc=new ComboBox(textVelocity);
        cmbcc.expand();

        driver.findElement(By.name(velo)).click();

        textDifficulty.sendKeys(diff);
        buttonUpdate.click();
    }

package steps;

public class OutEventsSteps {
WiniumDriver driver;
 public void setGroundOutTop1(String f,String dis,String v,String diff) throws InterruptedException {

    Thread.sleep(5000);
    BaseBallOutEvents baseOut = new BaseBallOutEvents(driver);
    baseOut=  PageFactory.initElements(DriverManager.driver, BaseBallOutEvents.class);
    baseOut.groundOuttop1(field, dist, velo, diff);

 }

main method

public class ReporterApp extends DriverManager{
    public static void main(String[] args) throws MalformedURLException, InterruptedException {


            DriverManager manager=new DriverManager();


             LoginSteps loginSteps = new LoginSteps();
             LineUps line=new LineUps(driver);


             OutEventsSteps outsteps=new OutEventsSteps();

             outsteps.setGroundOutTop1("","","", "");

    }
Error::
Exception in thread "main" java.lang.RuntimeException: java.lang.InstantiationException: page.BaseBallOutEvents

Whether I don’t use initialize winium driver in the BaseBallOutEvents. when automate the application until combobox selection throws error ::

Exception in thread “main” java.lang.ClassCastException: Specified
cast is not valid. Please use RemoteWebElement as parameter –



Source link https://sqa.stackexchange.com/questions/33599/-pattern-getting-java-lang-instantiationexception

LEAVE A REPLY

Please enter your comment!
Please enter your name here