小编Nic*_*ips的帖子

元素在点(215,251)错误时无法点击

我有一个非角度的应用程序,我点击一个链接,然后出现一个新的弹出模式.然后我可以选择上传图片或视频.我告诉量角器和/或webdriver点击上传照片按钮.

如果我使用:

var addPhotos = element(by.css('#px-select-photo')).click();
Run Code Online (Sandbox Code Playgroud)

我可以直观地看到按下的按钮然后测试失败并且错误无法点击...(215,251)

那么我以为我可以把它欺骗到点击xy位置(我假设这两个数字在错误中)并且我什么都没得到

我用的代码是:

browser.actions().mouseMove({
  x: 702,
  y: 621
}).click().perform();
Run Code Online (Sandbox Code Playgroud)

它点击,但不是按钮.

最后我试过这个:

var addPhotos = element(by.css('#px-select-photo'));
browser.executeScript('arguments[0].scrollIntoView()', addPhotos.getWebElement());
browser.actions().mouseMove(addPhotos).click().perform();
Run Code Online (Sandbox Code Playgroud)

这也没有结果.

另外,我收到此警告:

警告 - 找到多个定位器元素By.cssSelector("#px-select-photo")- 将使用第一个结果

但是,html文件中只有一个元素,不知道那些是什么.

selenium-chromedriver angularjs selenium-webdriver protractor

5
推荐指数
1
解决办法
1070
查看次数

元素不可见错误

我试图点击我页面上的上传文件链接,但我说上传链接不可见.我试过将鼠标悬停在链接和下面的代码上.这对我来说很容易修复,所以我真的很困惑如何点击这个链接.我尝试过的:

var EC = protractor.ExpectedConditions;
var uploadLink = element(by.model('roomPlanCtrl.mm2010File'));

browser.wait(EC.elementToBeClickable(uploadLink), 10000);
uploadLink.click();
Run Code Online (Sandbox Code Playgroud)

HTML:

<span class="dg-link ng-untouched ng-valid ng-dirty ng-valid-parse" ngf-select="" ng-model="roomPlanCtrl.mm2010File" accept=".mms" ng-hide="roomPlanCtrl.hideImportLinks">Upload a MeetingMatrix 2010 File</span>
Run Code Online (Sandbox Code Playgroud)

javascript selenium automation angularjs protractor

3
推荐指数
1
解决办法
5541
查看次数

拆分一个字符串,使其丢失http://以及'.'之后的任何内容.

我需要解析一个网址,以便只有我的服务器显示"NA30"但是当我进行分割时,我似乎无法得到na30.我试过修饰'.' 和'/',我想我只是让阵列部件错了.任何指导?

链接 https://na30.salesforce.com

我目前正在做什么

    string thisUrl;
    if (Helper.InstanceUrl.Contains(@"://"))
    {
        thisUrl = Helper.InstanceUrl.Split(new[] { "://" }, 2, StringSplitOptions.None)[1];
            return thisUrl.Split('/')[0].Split('.')[0];
    }
    return "";
Run Code Online (Sandbox Code Playgroud)

c# url split

3
推荐指数
1
解决办法
63
查看次数

C# 中的 JSON 到 CSV 和 CSV 到 JSON

我一直在寻找一种使用 C# 将 json 文件转换为 csv 的方法,反之亦然。我已经搜索过谷歌,但没有得到任何结果。到目前为止,我尝试过的所有关于堆栈溢出的答案都对我不起作用。有谁知道我可以使用哪些工具或教程来了解如何使用 .NET Framework 来完成此任务?通常我会发布我尝试过的内容,但是我显然离这里很远,所以这是毫无意义的。

c# csv parsing json

2
推荐指数
1
解决办法
1万
查看次数

Switch语句没有返回任何值

我有一个测试我正在写一个字符串读取然后获取该字符串并将其应用于switch语句.然后我将字符串与case匹配并设置一个整数值,我将其传递回spec页面,然后将int值传递给我用于if语句的另一个测试.我无法让int传递,所以if语句将无法正常工作.

切换对象:

var appsNotPurchased = 0;
this.checksHomeSublevel = function(mmCode) {
    browser.get('https://iplan-qa.meetingmatrix.com/Home/Index/' + mmCode);
    marketingObjects.level.getText().then(function(text) {
      var homeText = text;
      browser.get('https://iplan-qa.meetingmatrix.com/Home/Apps/' + mmCode);
      expect($('div.apps-subscription > span').getText()).toEqual('iPlan Level: ' + homeText);
      switch (homeText) {
        case 'Select':
          console.log(homeText);
          appsNotPurchased = 6;
          return appsNotPurchased;
          break;
        case 'Content':
          console.log(homeText);
          appsNotPurchased = 0 || 1 || 2 || 3 || 4 || 5 || 6;
          return appsNotPurchased;
          break;
      }


    });
Run Code Online (Sandbox Code Playgroud)

testSpec描述函数:

describe('should upload media: ', function() {

  it('should select add media', function() {
    var mmCode = …
Run Code Online (Sandbox Code Playgroud)

javascript switch-statement angularjs selenium-webdriver protractor

-1
推荐指数
1
解决办法
1765
查看次数