You need to find some other way to identify the button. In this case, you can use the tag name ("input") and the text we see on the screen ("Log In").
Try this to get you started:
webDriver.navigate().to("https://myportal.lau.edu.lb/Pages/studentPortal.aspx");
try {
// Wait to make sure the page has fully loaded for this example.
// Probably want something more sophisticated for your real test.
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Find the button based on tag name and value attribute.
WebElement button = null;
List<WebElement> inputs = webDriver.findElements(By.tagName("input"));
for (WebElement input : inputs) {
if (input.getAttribute("value").equals("Log In")) {
button = input;
break;
}
}
if (button == null) {
System.err.println("Cannot find button!");
} else {
System.out.println("Clicking button now!");
button.click();
}
Explanation
It is helpful to view the source code for this site in your browser.
List<WebElement> inputs = webDriver.findElements(By.tagName("input"));
This line of code searches the page and finds all elements with the tag name "input." That matches several elements, including the login button, as well as the username and password fields. So we need to narrow it down further...
for (WebElement input : inputs) {
This line of code loops over each input that we found above. Inside the loop, we will look more closely at the element to try to identify the login button.
if (input.getAttribute("value").equals("Log In")) {
As you noted in your original question, the login button has a "value" attribute with the value of "Log In." The other input elements do not have this attribute value. So in this line of code, we look for the one input element such that the value attribute is "Log In." Once we find that element, we have identified the button, so we store it to be clicked later.