0

I am working on a banking application which has Frames and Forms. I was able to identify webelements from Page 1 and 2. In Page 3, none of the webelements are identified. Am I missing something. Please help. Attached image of DOM Explorerenter image description here

     //page 1 - able to identify WebElements and navigating to Page 2

    driver.switchTo().frame("iframeContent");        
    Select bank = new Select(driver.findElement(By.name("selectRegionID")));
    bank.selectByVisibleText("460 - TEST BANK 460");

    driver.findElement(By.id("buttonOK")).click();      
    Thread.sleep(1000);

    //page 2 - able to identify WebElements
    driver.switchTo().frame("iframeContent");       
    driver.findElement(By.id("tdConsumerSearch")).click();
    //driver.switchTo().parentFrame(); //didn't make any difference with and without this line
    Thread.sleep(3000);


    //page 3 - unable to locate any WebElement(tried List/Button/Editbox).
    driver.switchTo().frame("iframeContent");   
    //driver.switchTo().frame(driver.findElement(By.id("iframeContent"))); --> Got this from other source, even this line didn't work

    Select bank1 = new Select(driver.findElement(By.name("selectBankID")));
    bank1.selectByVisibleText("ABC Bank");      //unable to perform this operation in page 3

Error Log: Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to find element with css selector == *[name='selectBankID'] For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: host: 'DT-4K3XT12', ip: '10.2.29.106', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_211' Driver info: org.openqa.selenium.ie.InternetExplorerDriver Capabilities {acceptInsecureCerts: false, browserName: internet explorer, browserVersion: 11, javascriptEnabled: true, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), se:ieOptions: {browserAttachTimeout: 0, elementScrollBehavior: 0, enablePersistentHover: true, ie.browserCommandLineSwitches: , ie.ensureCleanSession: false, ie.fileUploadDialogTimeout: 3000, ie.forceCreateProcessApi: false, ignoreProtectedModeSettings: false, ignoreZoomSetting: false, initialBrowserUrl: http://localhost:18939/, nativeEvents: true, requireWindowFocus: false}, setWindowRect: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}} Session ID: 6ca654cf-ad3a-4be0-b758-08fb70be1138 *** Element info: {Using=name, value=selectBankID} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323) at org.openqa.selenium.remote.RemoteWebDriver.findElementByName(RemoteWebDriver.java:404) at org.openqa.selenium.By$ByName.findElement(By.java:284) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:315) at com.test.pkg.Sample.main(Sample.java:102)

rajesh k
  • 15
  • 5
  • Can you please share the error log you are getting? – Naveen Feb 18 '20 at 17:13
  • @Naveen, added Error Log – rajesh k Feb 18 '20 at 18:35
  • Did the linked answers help you? If not, is that element hidden before and becomes visible after clicking something? – Naveen Feb 19 '20 at 07:05
  • Linked answers didn't help. I resolved it. I had used one frame in my code. when I analysed DOM till the root, I saw my frame is inside another frame. So, I used two switchTo frames and it worked. Thanks for asking. – rajesh k Feb 20 '20 at 09:41

0 Answers0