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
Selenium 尝试运行有关量角器自动化的javascript示例时,意外标记非法_Selenium_Automation_Jasmine_Protractor - Fatal编程技术网

Selenium 尝试运行有关量角器自动化的javascript示例时,意外标记非法

Selenium 尝试运行有关量角器自动化的javascript示例时,意外标记非法,selenium,automation,jasmine,protractor,Selenium,Automation,Jasmine,Protractor,在尝试运行此示例时 当我点击cmd中的dragrator conf.js时,我得到了以下错误 exports.config = { directConnect: true, // Capabilities to be passed to the webdriver instance. capabilities: { 'browserName': 'chrome' },

在尝试运行此示例时 当我点击cmd中的dragrator conf.js时,我得到了以下错误

exports.config = {
          directConnect: true,

          // Capabilities to be passed to the webdriver instance.
          capabilities: {
            'browserName': 'chrome'
          },

          // Framework to use. Jasmine is recommended.
          framework: 'jasmine',

          // Spec patterns are relative to the current working directly when
          // protractor is called.
          specs: ['joe_spec.js'],

          // Options to be passed to Jasmine.
          jasmineNodeOpts: {
            defaultTimeoutInterval: 30000
          }
        };

C:\Users\Emna\Desktop\example>protractor conf.js
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
[launcher] Error: SyntaxError: Unexpected token ILLEGAL
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at C:\Users\Emna\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine\lib\jasmine.js:71:5
    at Array.forEach (native)
    at Jasmine.loadSpecs (C:\Users\Emna\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine\lib\jasmine.js:70:18)
[launcher] Process exited with error code 100

在这里,您可以复制、粘贴此示例代码并运行它:

describe('Enter text in element on Protractor Example page', function() {

    it ('to check that text entered in text box displays on page',function() {
        browser.get('http://www.joecolantonio.com/ProtractorExample.html');
            element(by.model('joeAngularText')).sendKeys('Joe Colantonio');
        element(by.binding('joeAngularText')).getText().then(function(text){
            console.log(text);
        });
    });
});
问题在于描述文件中使用的字符:
“和”都是它不喜欢的狡猾的字符。如果你用“和”替换它们,它就工作了…我刚刚测试了它们,当我使用你的代码时,我得到了与你得到的相同的错误消息。但是如果我改为“和”,错误就会消失。

在这里,这将起作用。复制、粘贴此示例代码并运行它:

describe('Enter text in element on Protractor Example page', function() {

    it ('to check that text entered in text box displays on page',function() {
        browser.get('http://www.joecolantonio.com/ProtractorExample.html');
            element(by.model('joeAngularText')).sendKeys('Joe Colantonio');
        element(by.binding('joeAngularText')).getText().then(function(text){
            console.log(text);
        });
    });
});
问题在于描述文件中使用的字符:
'和'都是它不喜欢的狡猾的字符..如果你用'和'替换它们,它会工作…我刚刚测试了它们,当我使用你的代码时,我得到了与你得到的相同的错误消息..但是如果我改为'和'然后错误消失了

你能用conf.js文件更新你的问题吗?Thanksok,完成了。Thanksher是joe_spec.js文件:descripe('在量角器示例页面的元素中输入文本'),function(){it(“检查文本框中输入的文本是否显示在页面上”),function(){browser.get(“”);element(by.model(“joeAngularText”)).sendKeys(“Joe Colantonio”);element(by.binding(“joeAngularText”)).getText().then(function(text){console.log(text);}});});您能用conf.js文件更新您的问题吗?Thanksok,完成了。Thanksher是Joe_spec.js文件:description('Enter text in element on gradutor Example page',function()){it(“检查文本框中输入的文本是否显示在页面上”,function(){browser.get(“”);element(by.model(“joeAngularText”)).sendKeys(“Joe Colantonio”);element(by.binding(“joeAngularText”)).getText()。然后(function(text){console.log(text);});});非常欢迎您,我很高兴能为您提供帮助:)我是初学者这是我使用角度JS和量角器的第一个示例:)非常欢迎您,我很高兴能为您提供帮助:)我是初学者这是我使用角度JS和量角器的第一个示例:)