Using selenium how do I fetch a html tags element, the html tag does not have any unique identifiers, below is the html code:
<form data-v-48e2f75a="">
<header data-v-48e2f75a="">
<h4 data-v-48e2f75a="">via email</h4>
</header>
<div data-v-48e2f75a="" class="form-wrap">
<div data-v-cccee08c="" data-v-48e2f75a="" class="input-wrap email-input" type="email">
<label data-v-cccee08c="">
<div data-v-cccee08c="" class="input-inner-wrap has-icon">
<!--The below input tag is one of the tags I need to fetch-->
<input data-v-cccee08c="" placeholder=" " type="email"> <i data-v-cccee08c="" class="input-label-icon icon-envelope-o"></i> <span data-v-cccee08c="" class="input-label">Your E-mail</span> <!---->
</div>
<!----> <!----> <!---->
</label>
</div>
<div data-v-cccee08c="" data-v-48e2f75a="" class="input-wrap password-input" type="password">
<label data-v-cccee08c="">
<div data-v-cccee08c="" class="input-inner-wrap has-icon">
<input data-v-cccee08c="" placeholder=" " type="password"> <i data-v-cccee08c="" class="input-label-icon icon-unlock"></i> <span data-v-cccee08c="" class="input-label">Your Password</span> <!---->
</div>
<!----> <!----> <!---->
</label>
</div>
</div>
<p data-v-48e2f75a="" class="secondary-utilities forgot-password"><span data-v-48e2f75a="">Forgot password?</span></p>
<footer data-v-48e2f75a="" class="form-footer">
<div data-v-48e2f75a="" class="secondary-utilities registration">
<p data-v-48e2f75a="">Don't have an account?</p>
<span data-v-48e2f75a="">Sign up new account</span>
</div>
<button data-v-48e2f75a="" class="app-button rose-button min-width">Sign in</button>
</footer>
</form>
How I have been trying to get the element / things I've tried:
public static boolean login(WebDriver browser, String email, String password){
List<WebElement> elements = browser.findElements(By.xpath("//input[@type='email' or @type='password']"));
System.out.println();
for (WebElement element : elements){
System.out.println(element.getTagName());
System.out.println(element.toString());
}
return false;
}
however the above method keeps returning null, below are some of the other methods I've tried:
List<WebElement> elements = browser.findElements(By.id("input[type='email']"));
List<WebElement> elements = browser.findElements(By.cssSelector("*[type='email']"));
List<WebElement> elements = browser.findElements(By.cssSelector("*[type='email']"));
The tag is surrounded by some dividers...