简体   繁体   English

如何在8080端口打开页面

[英]How to open page on port 8080

Im trying to open a page using java and selenium on port 8080. Ive tried using the page and :8080 but the page continually keeps opening on a different port.我试图在端口 8080 上使用 java 和 selenium 打开一个页面。我尝试使用该页面和 :8080 但该页面不断地在不同的端口上打开。 Im basically trying to use zap and it configured to use firefox on port 8080. ANy help appreciated.我基本上尝试使用 zap 并将其配置为在端口 8080 上使用 firefox。感谢任何帮助。 Ive added my test and my class thats added to the test below, i think somewhere int he driver part it must call a different port but i cant see how this is happening我已经将我的测试和我的课程添加到下面的测试中,我认为在驱动程序部分的某个地方它必须调用不同的端口,但我看不到这是如何发生的

Test:测试:

public class ZapScanTest  {
static Logger log = Logger.getLogger(ZapScanTest.class.getName());
private final static String ZAP_PROXYHOST = "127.0.0.1";
private final static int ZAP_PROXYPORT = 8080;
private final static String ZAP_APIKEY = null;

// Change this to the appropriate driver for the OS, alternatives in the 
drivers directory
private final static String FIREFOX_DRIVER_PATH = 
"drivers/geckodriver.exe";
private final static String MEDIUM = "MEDIUM";
private final static String HIGH = "HIGH";
private ScanningProxy zapScanner;
private Spider zapSpider;
private WebDriver driver;
private Dec myApp;
private final static String[] policyNames = {"directory-browsing","cross- 
site-scripting","sql-injection","path-traversal","remote-file- 
inclusion","server-side-include",
        "script-active-scan-rules","server-side-code-injection","external- 
redirect","crlf-injection"};
int currentScanID;


@Before
public void setup() {
    zapScanner = new 
ZAProxyScanner(ZAP_PROXYHOST,ZAP_PROXYPORT,ZAP_APIKEY);
    zapScanner.clear(); //Start a new session
    zapSpider = (Spider)zapScanner;
    log.info("Created client to ZAP API");
    driver = DriverFactory. createProxyDriver("firefox",createZapProxyConfigurationForWebDriver(), FIREFOX_DRIVER_PATH);


    myApp = new Dec(driver);
    //myApp.registerUser(); //Doesn't matter if user already exists, bodgeit just throws an error
}

@After
public void after() {
    driver.quit();
}

@Test
public void testSecurityVulnerabilitiesBeforeLogin()throws Exception  {
    myApp.login();
    log.info("Spidering...");
    spiderWithZap();
    log.info("Spider done.");

    setAlertAndAttackStrength();
    zapScanner.setEnablePassiveScan(true);
    scanWithZap();

    List<Alert> alerts = filterAlerts(zapScanner.getAlerts());
    logAlerts(alerts);
    assertThat(alerts.size(), equalTo(0));
}

Dec class:十二月班:

public class Sportdec {
WebDriver driver;
final static String BASE_URL = "https://web-game-stage.dec.com/games:8080";
final static String USERNAME = "dec2009@hotmail.com";
final static String PASSWORD = "tables";

public Dec(WebDriver driver) {


    this.driver = driver;
    this.driver.manage().timeouts().pageLoadTimeout(5, TimeUnit.SECONDS);
    this.driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS);
}

public void login()throws Exception {
    driver.get(BASE_URL);
    Header header = new Header();
    header.guest_select_login();
    Pages.Login login = new Pages.Login();

    login.login_with_empty_fields();

    login.login_with_invalid_email();

    login.email_or_password_incorrect();


    login.login_open_and_close();

} }

By any chance have you tried using this你有没有试过使用这个

final static String BASE_URL = "https://web-game-stage.dec.com:8080/games";

instead of this而不是这个

final static String BASE_URL = "https://web-game-stage.dec.com/games:8080";

You are adding port number to the games directory instead of the host您正在将端口号添加到游戏目录而不是主机

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将默认端口号更改为Tomcat端口号8080? - How to Change Default Port no to Tomcat Port No 8080? 如何直接在 localhost:8080 中打开我的 web 应用程序而不是 tomcat 主页 - How can I open my web application in localhost:8080 directly instead of tomcat home page Tomcat 启动但主页无法打开,网址为 http://localhost:8080 - Tomcat starts but home page cannot open with url http://localhost:8080 在端口8080上运行时如何发布Tomcat Web应用程序? - How to publish a tomcat webapp while running on port 8080? OpenTripPlanner:如何在不同于默认8080的端口上运行独立实例? - OpenTripPlanner: How to run standalone instance on a port different from default 8080? 如何将其余请求从localhost:8080重定向到其他端口? - How to redirect rest requests from localhost:8080 to different port? 如何在os x mavericks中将端口80转发到8080 - How to forward port 80 to 8080 in os x mavericks 如何更改jax ws webservice的8080端口? - How to change port from 8080 of jax ws webservice? 如何在 ubuntu 20.04 LTS 中为 Tomcat 释放端口 8080 - How to make port 8080 free for Tomcat in ubuntu 20.04 LTS 如何在 Windows Vista 命令提示符中检查端口 8080? - How to check port 8080 in Windows Vista command prompt?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM