1

I am attempting to login in the linked website. It looks straightforward and I have done this successfully in other websites. I can login manually. My code is

Dim bot As New WebDriver
bot.Start "chrome", "https://mbwebedi.mahle.com"
bot.Get "/webedi/jsp/index.jsp"
bot.FindElementByName("Login").SendKeys "ABC123"

I receive the error:

"NoSuchElementError Element not found for Name=Login"

The element's text is:

<input class="loginInput" type="text" name="Login" maxlength="30">`

I can proceed manually at this point, so I don't think focus is the issue. What I am doing wrong?

The screen with element inspection open

DebanjanB
  • 118,661
  • 30
  • 168
  • 217

1 Answers1

1

To send a character sequence to the Username field as the the desired element is within an <iframe> so youhave to:

  • First SwitchToFrame.
  • Then locate the element.
  • You can use either of the following Locator Strategies:

    • Using FindElementByCss:

      bot.SwitchToFrame "liefercontent"
      bot.FindElementByCss("input.loginInput[name='Login']").SendKeys "ABC123"
      
    • Using FindElementByXPath:

      bot.SwitchToFrame "liefercontent"
      bot.FindElementByXPath("//input[@class='loginInput' and @name='Login']").SendKeys "ABC123"
      

You can find a relevant discussion in Element doesn't exist although it has ID attribute


tl; dr

Ways to deal with #document under iframe

DebanjanB
  • 118,661
  • 30
  • 168
  • 217