Search code examples
javaweb-scrapinghtmlunit

How to select the image input type with HtmlUnit


I have to select following image button. How can I do that using HtmlUnit?

For other elements, I am using this kind of approach, but in the case below I don't have name either Id. How do I select the input type using HtmlUnit?

var email = driver.FindElement(By.Name("userName"));

<input type="image" name="" src="https://a248.e.akamai.net/f/248/16813/4h/www-origin.walmart.com/i/buttons/BTN_sign_in_67x25.gif" border="0" class="SignInBtn" alt="Sign In">

Solution

  • "XPath" is the short answer. But beware of its caveats. If you're testing, I recommend you switch to WebDriver instead