0

Error:Failed: invalid argument: 'id' can not be string (Session info: chrome=88.0.4324.146) Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' System info: host: 'RADA-HYD-01', ip: '192.168.0.165', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_261' Driver info: driver.version: unknown

Hi can anyone please help me in resolving this issue.

Script:

browser.switchTo().frame('courses-iframe');
    element(by.css("a[href*='Login']")).getText().then(function (Result) {
      console.log(Result);
    });
Explorer
  • 79
  • 8

2 Answers2

1
    browser.switchTo().frame(element(by.id('courses-iframe'))).then(function(){
        element(by.css("a[href*='Login']")).getText().then(function (Result) {
          console.log(Result);
        });
});

https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/lib/webdriver_exports_TargetLocator.html

the switchto frame expcts number,element and null , not string. Where number is iindex like first frame, second frame etc

PDHide
  • 18,113
  • 2
  • 31
  • 46
0

Someone suggested the following fix:

browser.switchTo().frame('courses-iframe');
element(by.css("a[href*='Login']")).getText().then(function (Result) {
  console.log(Result);
});

I inserted it into my code and got the following error:

RangeError: Maximum call stack size exceeded

Basically what this means is that somewhere in my code, I'm calling a function which in turn calls another function and so forth, until I hit the call stack limit.

(Taken from the following answer)

I solved my problem by adding

      capabilities: {
      browserName: 'chrome',
      'goog:chromeOptions': {
        w3c: false
       },
       
},

Apparently, there's a compatibility issue with the action class and switch on Chrome after version 75.

Hope this helps somehow.

Kane
  • 1
  • 3