Forum Discussion

prabhjot88singh's avatar
prabhjot88singh
Contributor
5 years ago
Solved

DDT.CURRENTDRIVER IS null or not an object

Hi Team,

 

I am using below code:

 

function driveContributionFile()

{
DDT.CSVDriver("C:\\Users\\singhp\\Desktop\\PENFAX_REGRESSION_SUITE\\Input Data\\createContribution.csv");
DDT.CurrentDriver.DriveMethod("Unit1.createContributionFile");
}

 

function createContributionFile()
{
Browsers.Item(btChrome).Navigate("https://uat-dataupload.optrustselect.com/opts/");
var browser = Aliases.browser;
var form = browser.pageOptrustSelectEmployer.sectionContent.formVmLoginform;
var textbox = form.textboxUsername;
textbox.Click(108, 22);
textbox.SetText("npirzada@ncpeel.ca");
textbox.Keys("[Tab]");
var passwordBox = form.passwordboxPassword;
passwordBox.SetText("Chicken1!");
passwordBox.Keys("[Enter]");
var page = browser.pageOptrustSelectEmployerDashboa;
page.Wait();
var createFile= Aliases.browser.pageOptrustSelectEmployerDashboa.panel.panel.panel.sectionContent.sectionDashboardView.link2.textnode
createFile.Click();
var selectFileType= Aliases.browser.pageOptrustSelectEmployerDashboa.form.textnode2;
selectFileType.Click();
var selectContributionFile = Aliases.browser.pageOptrustSelectEmployerDashboa.panel2.textnode
selectContributionFile.Click();
var payCycleDropdown = Aliases.browser.pageOptrustSelectEmployerDashboa.form2.panel.panel.panel.textnode
payCycleDropdown.Click();
Aliases.browser.pageOptrustSelectEmployerDashboa.form2.panel.panel.panel.Textbox("PAY_SCHED_input").SetText(DDT.CurrentDriver.Value("payscheduled"));
}

 

It is failing in the below last line, Line 31, SAYING DDT is null or not an object

Aliases.browser.pageOptrustSelectEmployerDashboa.form2.panel.panel.panel.Textbox("PAY_SCHED_input").SetText(DDT.CurrentDriver.Value("payscheduled"));

 

1. Please note , here payscheduled is my column  name in csv file.

2. Also, i have given "\\" in the path for CSV file under function driveContributionFile(), but still it is failing.

 

Screenshot attached.

  • LinoTadros's avatar
    LinoTadros
    5 years ago

    That is because you are executing the function createContributionFile() instead of executing the driveContributionFile()

    Once DDT.CurrentDriver.DriveMethod(...) is involved, you can no longer call the driven method yourself.  It has to be called from the driver method only otherwise the DDT object will be null and will fail on first use.

     

    Cheers

    Lino

3 Replies

  • I don't see where you are calling driveContributionFile. Are you setting your DDT?

    • LinoTadros's avatar
      LinoTadros
      Community Hero

      That is because you are executing the function createContributionFile() instead of executing the driveContributionFile()

      Once DDT.CurrentDriver.DriveMethod(...) is involved, you can no longer call the driven method yourself.  It has to be called from the driver method only otherwise the DDT object will be null and will fail on first use.

       

      Cheers

      Lino