[英]java attempting to assign weaker access privilege error
[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. 这是我如何使用Wait类。 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. 您尝试通过
until
方法覆盖com.thoughtworks.selenium.Wait
类中具有public
访问权限的until
方法,该方法仅包可见。
You cannot override a method and reduce visibility. 您无法覆盖方法并降低可见性。 You can only increase the visibility (eg overriding a
protected
method and making it public
) 您只能提高可见性(例如,覆盖
protected
方法并将其public
)
So the fix would be to add the public
keyword to these methods 因此,修复方法是将
public
关键字添加到这些方法中
new Wait("") {public boolean until() {return false;}};session().open("/");
new Wait("") {public boolean until() {return false;}};session().click("id=btnLogin-button");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.