I have 2 classes belonging to the same package in a java testNG project and I have declared \'webdriver driver\' public static in class A. In that class, chrome launched, ur
This is an issue caused by the Firefox version in use, 49.0.2. It's a weird case and unclear why login functionality is being imparted by the browser version in use;however, resolving the issue requires a downgrade to version 46.0. This fixed the problem.
edit: See this very relevant question and answer
If you edit the post to include relevant html, this would be easier to help with.
Try with cssSelector:
Inspect the login button. Within the inspector, right click the element and copy the CSS Selector.
driver.findElement(By.cssSelector("copypasta")).click();
Try to locate by xpath using several different methods listed in this useful cheat sheet.
For example, if the inner html text for your button is 'Login':
driver.findElement(By.xpath("//button[contains(text(), 'Login']")).click();
There are many different ways to do this, so looking at your html will help people help you, I think.