0

I've tried FindElementByName here and it seems like it should recognize this name, but I get a no such element error...

What do I miss? This is on the site Intacct.com. Doesn't seem to be a unique CSS I can turn up, and the relative XPath is non-existent, according to ChroPath. Is there another way I can type into this dang

<input id="filter" class="filter" type="text" name="F_RECORDID" value="" onkeypress="if (event.keyCode == 13) c('.rb','0');" ctype="text">
Sub newCSS()
    Dim bot As New Selenium.WebDriver

    bot.Start "Chrome", "https://www.intacct.com/ia/acct/login.phtml?_ga=2.13247287.1007588550.1536894830-1229002215.1536894830"
    bot.get "/"
    bot.FindElementByXPath("//span[@class='iamenutitle'][contains(text(),'Accounts Payable')]").Click
    bot.FindElementByCss("[menuitemrefno='126']").Click
    bot.SwitchToFrame .FindElementById("iamain")

enter image description here

QHarr
  • 83,427
  • 12
  • 54
  • 101
Sean
  • 71
  • 2
  • 8
  • 1
    Please explain your question in more detail and add the failing code. – wp78de Sep 16 '18 at 04:38
  • 1
    Please read why [a screenshot of code is a bad idea](https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors). Paste the code and properly format it instead. – JeffC Sep 16 '18 at 05:27
  • 1
    The element you are looking for has an ID, 'filter'. You should always prefer an ID when it's available. It looks like that element is in an IFRAME (ID = 'iamain'). You will need to switch to it and then find the element. You may also need to add a wait. – JeffC Sep 16 '18 at 05:29
  • 1
    Please include the actual HTML as code using the snippet tool via [edit]. Include your current coding so we are clear on current access method. Without that this question risks being closed. – QHarr Sep 16 '18 at 05:35
  • Thanks to all who replied. I apologize for not following conventions.Thank you Jeff, you are absolutely right, that is why it's not working. So now I'm researching how to switch focus into that frame. – Sean Sep 16 '18 at 22:48
  • Got it! 'switch to iframe ; bot.SwitchToFrame "iamain" ; bot.FindElementByName("F_RECORDID").SendKeys "123" – Sean Sep 17 '18 at 02:43

1 Answers1

1

Try the following to switch to the iframe and then get the element. It is faster across all browsers to use an id, which theoretically is unique to the page. I then show you a method with CSS selector which is faster than using FindElementByName across most browsers and later versions of IE as they are optimized for CSS. If you want to read about the selector speeds please see my answer here. You can also switch to iframes by index.

Option Explicit
Public Sub test()
    Dim driver As New ChromeDriver, ele As Object
    Const URL = "URL"
    With d
        .Start "Chrome"
        .get URL
        'Other steps
        .SwitchToFrame "iamain"
        Set ele = .FindElementById("filter").SendKeys "123"  '.FindElementByCss("[name='F_RECORDID']").SendKeys "123" 
        'OTHER CODE
        .Quit
    End With
End Sub
QHarr
  • 83,427
  • 12
  • 54
  • 101