Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当我从JSON文件中输入值时,它在网页中显示为未定义的值,知道吗?_Json_Selenium_Jasmine_Protractor_Data Driven Tests - Fatal编程技术网

当我从JSON文件中输入值时,它在网页中显示为未定义的值,知道吗?

当我从JSON文件中输入值时,它在网页中显示为未定义的值,知道吗?,json,selenium,jasmine,protractor,data-driven-tests,Json,Selenium,Jasmine,Protractor,Data Driven Tests,当我从JSON文件中输入值时,它在网页中显示为未定义的值,知道吗 JSON文件: [ { "firstName":"1233232322", "lastName":"ramakrishnan", "email":"parthiramkrish@gmail.com", "password":"secondmay1991", "confirmPassword":"secondmay1991" } ] 'use strict'; brows

当我从JSON文件中输入值时,它在网页中显示为未定义的值,知道吗

JSON文件:

[
  {

    "firstName":"1233232322",
    "lastName":"ramakrishnan",  
    "email":"parthiramkrish@gmail.com",
    "password":"secondmay1991",
    "confirmPassword":"secondmay1991"
  }

]
'use strict';

 browser.ignoreSynchronization = true;

var testdata1 = require('./testdata1.json');

describe("Test the inksoft.com create an account page", function () {
 it("enter the account details", function () {
     browser.get("https://qa.inksoft.com/EGT");
     browser.ignoreSynchronization = true;
     browser.sleep(15000);
     element(by.xpath("//a[text()='Create Account']")).click();
     browser.sleep(20000);
     element(by.xpath("//input[@name='firstName']")).sendKeys( testdata1.firstName);
     element(by.xpath("//input[@name='lastName']")).sendKeys( testdata1.lastName);
     element(by.xpath("//input[@name='email']")).sendKeys( testdata1.email);
     element(by.xpath("//input[@name='password']")).sendKeys( testdata1.password);
     element(by.xpath("//input[@name='confirmPassword']")).sendKeys( testdata1.confirmassword);
     element(by.xpath("//input[@type='submit']")).click();
  });
});
 exports.config = {

 //The address of a running selenium server.

 seleniumAddress: 'http://localhost:4444/wd/hub',

 //Here we specify the name of the specs files.

 framework: 'jasmine',

 specs: ['inksoftdata.js'],

 jasmineNodeOpts: {

    showColors: true,

    includeStackTrace: true,

    defaultTimeoutInterval: 1440000

 },

}
规范文件:

[
  {

    "firstName":"1233232322",
    "lastName":"ramakrishnan",  
    "email":"parthiramkrish@gmail.com",
    "password":"secondmay1991",
    "confirmPassword":"secondmay1991"
  }

]
'use strict';

 browser.ignoreSynchronization = true;

var testdata1 = require('./testdata1.json');

describe("Test the inksoft.com create an account page", function () {
 it("enter the account details", function () {
     browser.get("https://qa.inksoft.com/EGT");
     browser.ignoreSynchronization = true;
     browser.sleep(15000);
     element(by.xpath("//a[text()='Create Account']")).click();
     browser.sleep(20000);
     element(by.xpath("//input[@name='firstName']")).sendKeys( testdata1.firstName);
     element(by.xpath("//input[@name='lastName']")).sendKeys( testdata1.lastName);
     element(by.xpath("//input[@name='email']")).sendKeys( testdata1.email);
     element(by.xpath("//input[@name='password']")).sendKeys( testdata1.password);
     element(by.xpath("//input[@name='confirmPassword']")).sendKeys( testdata1.confirmassword);
     element(by.xpath("//input[@type='submit']")).click();
  });
});
 exports.config = {

 //The address of a running selenium server.

 seleniumAddress: 'http://localhost:4444/wd/hub',

 //Here we specify the name of the specs files.

 framework: 'jasmine',

 specs: ['inksoftdata.js'],

 jasmineNodeOpts: {

    showColors: true,

    includeStackTrace: true,

    defaultTimeoutInterval: 1440000

 },

}
CONF文件:

[
  {

    "firstName":"1233232322",
    "lastName":"ramakrishnan",  
    "email":"parthiramkrish@gmail.com",
    "password":"secondmay1991",
    "confirmPassword":"secondmay1991"
  }

]
'use strict';

 browser.ignoreSynchronization = true;

var testdata1 = require('./testdata1.json');

describe("Test the inksoft.com create an account page", function () {
 it("enter the account details", function () {
     browser.get("https://qa.inksoft.com/EGT");
     browser.ignoreSynchronization = true;
     browser.sleep(15000);
     element(by.xpath("//a[text()='Create Account']")).click();
     browser.sleep(20000);
     element(by.xpath("//input[@name='firstName']")).sendKeys( testdata1.firstName);
     element(by.xpath("//input[@name='lastName']")).sendKeys( testdata1.lastName);
     element(by.xpath("//input[@name='email']")).sendKeys( testdata1.email);
     element(by.xpath("//input[@name='password']")).sendKeys( testdata1.password);
     element(by.xpath("//input[@name='confirmPassword']")).sendKeys( testdata1.confirmassword);
     element(by.xpath("//input[@type='submit']")).click();
  });
});
 exports.config = {

 //The address of a running selenium server.

 seleniumAddress: 'http://localhost:4444/wd/hub',

 //Here we specify the name of the specs files.

 framework: 'jasmine',

 specs: ['inksoftdata.js'],

 jasmineNodeOpts: {

    showColors: true,

    includeStackTrace: true,

    defaultTimeoutInterval: 1440000

 },

}

testdata1.json
文件中,所有数据都存储为对象数组。因此,要从
testdata1
变量访问数据,需要指定数组索引,如
testdata1[0]。firstName