laxmankumar
12 years agoOccasional Contributor
Unable to solve SYNTAX error and Unable to execute DDT text
Hi,
I just recorded a script and I am facing couple of issues here...
1. System show syntax error at the "catch" statement. Dont know why?
2. When I dont use "try catch" statements and just use a function test1(), my script does not perform and I get JScript run-time error at DDT.ExcelDriver("C:\\LaxTest1.xlsx","Sheet1", true); . I installed "AccessDatabaseEngine.exe" file as suggested for ACEDriver setup. Eventhen I get JScript Runtime error.
If you need any info, please let me know.
Below is the script.
function Main()
{
try
{
DDT.ExcelDriver("C:\\LaxTest1.xlsx","Sheet1", true);
DDT.CurrentDriver.DriveMethod("Unit1.Test1");
}
catch
{
Log.error("Exception", exception.description);
}
}
function Test1()
{
var browser;
var page;
var form;
var textbox;
var table;
Browsers.Item(btIExplorer, "", Browsers.pX64).Run("http://www.cnn.com/");
browser = Aliases.browser;
browser.ToUrl("http://www.qaforums.com/");
page = browser.pageSoftwareTestingAndQualityAss;
form = page.form;
textbox = form.textboxLoginname;
textbox.Click(27, 13);
textbox.SetText(DDT.CurrentDriver.Value("UserName"));
textbox.Keys("[Tab]");
table = form.tableAutonumber1;
table.passwordboxLoginpass.SetText(DDT.CurrentDriver.Value("Password"));
table.submitbuttonButtlogin.ClickButton();
page = browser.pageSoftwareQualityAssuranceForu2;
page.Wait();
page.table.linkSearch.Click();
page = browser.pageSoftwareQualityAssuranceForu;
page.Wait();
form = page.table.form;
//form.selectForum.SelectItem(2);
form.selectForum.ClickItem("*AutomatedQA / SmartBear TestComplete");
table = form.tableTablesurround.cell.tableTableborders;
textbox = table.cellLighttable.textboxWords;
textbox.Click(40, 7);
textbox.SetText("DataDriven");
table.submitbuttonButtsubmit.ClickButton();
page = browser.pageSoftwareQualityAssuranceForu3;
page.Wait();
page.table.linkLogout.Click();
browser.pageSoftwareQualityAssuranceForu4.Wait();
}
I just recorded a script and I am facing couple of issues here...
1. System show syntax error at the "catch" statement. Dont know why?
2. When I dont use "try catch" statements and just use a function test1(), my script does not perform and I get JScript run-time error at DDT.ExcelDriver("C:\\LaxTest1.xlsx","Sheet1", true); . I installed "AccessDatabaseEngine.exe" file as suggested for ACEDriver setup. Eventhen I get JScript Runtime error.
If you need any info, please let me know.
Below is the script.
function Main()
{
try
{
DDT.ExcelDriver("C:\\LaxTest1.xlsx","Sheet1", true);
DDT.CurrentDriver.DriveMethod("Unit1.Test1");
}
catch
{
Log.error("Exception", exception.description);
}
}
function Test1()
{
var browser;
var page;
var form;
var textbox;
var table;
Browsers.Item(btIExplorer, "", Browsers.pX64).Run("http://www.cnn.com/");
browser = Aliases.browser;
browser.ToUrl("http://www.qaforums.com/");
page = browser.pageSoftwareTestingAndQualityAss;
form = page.form;
textbox = form.textboxLoginname;
textbox.Click(27, 13);
textbox.SetText(DDT.CurrentDriver.Value("UserName"));
textbox.Keys("[Tab]");
table = form.tableAutonumber1;
table.passwordboxLoginpass.SetText(DDT.CurrentDriver.Value("Password"));
table.submitbuttonButtlogin.ClickButton();
page = browser.pageSoftwareQualityAssuranceForu2;
page.Wait();
page.table.linkSearch.Click();
page = browser.pageSoftwareQualityAssuranceForu;
page.Wait();
form = page.table.form;
//form.selectForum.SelectItem(2);
form.selectForum.ClickItem("*AutomatedQA / SmartBear TestComplete");
table = form.tableTablesurround.cell.tableTableborders;
textbox = table.cellLighttable.textboxWords;
textbox.Click(40, 7);
textbox.SetText("DataDriven");
table.submitbuttonButtsubmit.ClickButton();
page = browser.pageSoftwareQualityAssuranceForu3;
page.Wait();
page.table.linkLogout.Click();
browser.pageSoftwareQualityAssuranceForu4.Wait();
}
- Hi,
First of all, You use try...catch incorrectly. You miss the exception name after the catch statement. For instance, see example here
http://msdn.microsoft.com/en-us/library/k4hea629(v=vs.90).aspx
As for the problem with DDT, you mixed up two approaches: driving the DDT data and DriveMethod.
This article displays both approaches by examples
http://support.smartbear.com/viewarticle/32584/