I've been trying to run this piece of code for a few days to log in. The problem that I have to face without having found a solution is the following: I do not understand why the driver does not make the switch and how you see the error is that it does not find the element. Thank you for the suggestions. Good day
WebDriver driver = new HtmlUnitDriver(BrowserVersion.BEST_SUPPORTED);
driver.get("https://transparency.entsoe.eu/");
System.out.println("current page " + driver.getCurrentUrl());
WebElement login = driver.findElement(By.id("login-dialog-visible"));
login.click();
System.out.println("current page " + driver.getCurrentUrl());
driver.switchTo().frame(driver
.findElement(By.cssSelector(".ui-dialog.ui-widget.ui-widget-content.ui-front.ui-dialog-buttons")));
driver.findElement(By.id("login-form-content"));
follow the website html code
<div id="temp-login-div" class="ui-dialog-content ui-widget-content"
style="width: auto; min-height: 129px; max-height: none; height: auto;">
<div id="login-form-content">
<div class="login-form">
<div class="section-header">Please login</div>
<div class="login-form-content">
<form id="login-form" method="POST"
action="https://transparency.entsoe.eu/login"
novalidate="novalidate">
<input type="hidden" name="url" id="target-url"
value="/dashboard/show">
<div class="formItem">
<label for="email">Email address</label> <input type="text"
name="username" id="email"
class="validation-required_true validation-email_true">
</div>
<div class="formItem">
<label for="password">Password</label> <input type="password"
name="password" id="password"
class="validation-required_true validation-maxlength_100">
</div>
<div class="clear"></div>
<div id="master-error-message">Some errors found. Please
check filled inputs.</div>
<div id="login-failed-message">Login failed</div>
<div class="submit-line">
<div>
<input type="submit" value="Sign In"
class="ui-button ui-widget ui-state-default ui-corner-all"
role="button" aria-disabled="false">
</div>
<div id="forgot-password">
<a href="https://transparency.entsoe.eu/homepageLogin#"
id="forgot-password-link">Forgot your password?</a>
</div>
</div>
</form>
</div>
<div class="secured-login">
<img src="./Login_files/Icon_Secured_login.png" alt="Secured">
<div>This login is secured.</div>
</div>
</div>
<div class="registration-form">
<div class="section-header">Not registered yet?</div>
<div class="registration-form-content">
<div class="benefits-header">Benefits of a registered
account:</div>
<div class="benefits">
<img src="./Login_files/Icon_Benefit.png" alt="Nike">
<div>Customise data views and dashboard</div>
</div>
<div class="benefits">
<img src="./Login_files/Icon_Benefit.png" alt="Nike">
<div>Download data tables and graphs</div>
</div>
<div class="benefits">
<img src="./Login_files/Icon_Benefit.png" alt="Nike">
<div>Access automated feeds, news etc...</div>
</div>
<div class="register-bottom-line">
<button id="register-now"
class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
role="button" aria-disabled="false">
<span class="ui-button-text">Register now</span>
</button>
<div class="free-registration">Free registration.</div>
</div>
</div>
</div>
<div id="forgot-password-form">
<div class="section-header">Forgot your password?</div>
<div id="forgot-password-form-content">
<div style="width: 250px">
<form id="send-password-request-form" novalidate="novalidate">
<div class="formItem">
<label for="forgot-email">Email address<span
class="required-field">*</span></label> <input id="forgot-email"
name="email" type="text"
class="validation-required_true validation-email_true">
</div>
</form>
<div id="master-error-message">Some errors found. Please
check fields.</div>
<div class="form-legend">
<span class="required-field">*</span>−required field
</div>
<div class="clear"></div>
<button id="send-email"
class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
role="button" aria-disabled="false">
<span class="ui-button-text">Send verification email</span>
</button>
</div>
</div>
</div>
</div>