Ask a Question

DDT.CURRENTDRIVER IS null or not an object

SOLVED
prabhjot88singh
Contributor

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.

3 REPLIES 3
vthomeschoolmom
Super Contributor

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

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

TanyaYatskovska
SmartBear Alumni (Retired)

Thanks for the help, vthomeschoolmom, LinoTadros!

 

@prabhjot88singh, did adding the driveContributionFile method help?

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



cancel
Showing results for 
Search instead for 
Did you mean: