Getting the following error while executing the below js. Please advise.
HTML:
<div id="iframeContainer">
<iframe class="selectedModulesIframe" frameborder="0" src="XXXXXX/?locale=en&security={"language":"en","token":"LYu1sFnCa6UHRTEs1Xsa3bs7","agentId":{"id":"SSHAIK"},"organisation":"RAIL-NSWT","distributedContextID":null,"securityModeCode":null}&module=SCHEDULECHANGELIST" id="SCHEDULE1552627852125" name="SCHEDULE1552627852125" style="height: 519px; width: 1903px;">
</iframe>
</div>
<span id="w10" atdelegate="d6" class="xWidget" style="width:85px;margin:0px 0px 0px 10px;">
<a class="xLink_std" href="javascript:(function(){})()" tabindex="1"">192429</a>
</span>
Here is my code:
browser.switchTo().frame(browser.driver.findElement(protractor.By.tagName('iframe'))).then(function(){
console.log('Iframe switch')
browser.driver.findElement(protractor.By.linkText("192429")).click().then(function(){
console.log('action performed')
})
})
Also try the below code:
browser.switchTo().frame(browser.driver.findElement(protractor.By.tagName('iframe'))).then(function(){
console.log('Iframe switch')
element(by.linkText('192429')).click();
})
Error response:
[16:49:46] I/launcher - Running 1 instances of WebDriver [16:49:46] I/hosted - Using the selenium server at http://localhost:4444/wd/hub Started Got the iframe Iframe switch [31mF[0m Failures: 1) Affected Passenger Notification Verify APR in Schedule Change UI Message: [31m Failed: no such element: Unable to locate element: {"method":"link text","selector":"192429"} (Session info: chrome=72.0.3626.121) (Driver info: chromedriver=2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.15063 x86_64)[0m Stack: NoSuchElementError: no such element: Unable to locate element: {"method":"link text","selector":"192429"} (Session info: chrome=72.0.3626.121) (Driver info: chromedriver=2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.15063 x86_64) at Object.checkLegacyResponse (C:\Users\sshaik\eclipse-workspace\Protractor_Orion\protractor\node_modules\selenium-webdriver\lib\error.js:546:15)
HTML: