[javac] U:\dms-webui-testing\test-java\dmswebui\CR\TestLogin.java:16: until() in cannot override until() in com.thoughtworks.selenium.Wait; attempting to assign weaker access privileges; was public
I am getting above error for a fairly simple code:
package dmswebui.CR;
import org.infineta.webui.selenium4j.MainTestCase;
public class TestLogin extends MainTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
startSeleniumSession("ChromeDriver", "somesite");
}
public void testMethod() throws Exception {
new Wait("") {boolean until() {return false;}};session().open("/");
new Wait("") {boolean until() {return false;}};session().click("id=btnLogin-button"); session().waitForPageToLoad("30000");
for (int second = 0;; second++) {
if (second >= 60) fail("timeout 'waitForTextPresent:Logoff' ");
try { if (session().isTextPresent("Logoff")) break; } catch (Exception e) {}
Thread.sleep(1000);
}
new Wait("") {boolean until() {return false;}};session().click("id=btnUserLogout-button");
new Wait("") {boolean until() {return false;}};session().click("id=yui-gen0-button"); session().waitForPageToLoad("30000");
}
public void tearDown() throws Exception {
super.tearDown();
closeSeleniumSession();
}
}
here is how I use Wait class. Please help me to understand this error.
The lines with the problem are the two below
new Wait("") {boolean until() {return false;}};session().open("/"); new Wait("") {boolean until() {return false;}};session().click("id=btnLogin-button");
You try to override the until
method which has public
access in the com.thoughtworks.selenium.Wait
class by a until
method which is only package visible.
You cannot override a method and reduce visibility. You can only increase the visibility (e.g. overriding a protected
method and making it public
)
So the fix would be to add the public
keyword to these methods
new Wait("") {public boolean until() {return false;}};session().open("/"); new Wait("") {public boolean until() {return false;}};session().click("id=btnLogin-button");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With