0

ファイルをアップロードして Windows エクスプローラー ウィンドウを閉じるのに問題があります。テストは正常に実行され、エラーは表示されませんが、ファイルがアップロードされず、アップロード ポップアップが閉じられません。

ApplyJob.java

package com.example.tests;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.Select;

public class IJ_ApplyForJob {

 IJ_Login login = new IJ_Login();

@Test
public void SFJ_HomeSearchBoxNotLoggedIn(WebDriver driver)
{
    driver.findElement(By.id("kwdInput")).clear();
    driver.findElement(By.id("kwdInput")).sendKeys("Testing");
    //find the dropdown and search for the location dublin
    Select ddSelectLoc = new Select(driver.findElement(By.name("Location")));
    ddSelectLoc.selectByVisibleText("Dublin");
    //find the dropdown and search for the Category IT
    Select ddSelectCat = new Select(driver.findElement(By.id("home-category")));
    ddSelectCat.selectByVisibleText("IT");
    //click search button and search for term.
    driver.findElement(By.className("btn-search")).click();
    //click first job title
        driver.findElement(By.id("ctl00_ctl00_cphMain_cphMain_ucJobs_rptResult_ctl01_hlTitle")).click();
    //click apply for job
    driver.findElement(By.className("ApplyForJobButton")).click();
    //complete form
    driver.findElement(By.id("ctl00_ctl00_cphMain_cphMain_ucApplyJob_txtComments")).clear();
    driver.findElement(By.id("ctl00_ctl00_cphMain_cphMain_ucApplyJob_txtComments")).sendKeys("Cover Letter Testing");
    driver.findElement(By.id("ctl00_ctl00_cphMain_cphMain_ucApplyJob_txtFirstName")).clear();
    driver.findElement(By.id("ctl00_ctl00_cphMain_cphMain_ucApplyJob_txtFirstName")).sendKeys("Name");
    driver.findElement(By.id("ctl00_ctl00_cphMain_cphMain_ucApplyJob_txtSecondName")).clear();
    driver.findElement(By.id("ctl00_ctl00_cphMain_cphMain_ucApplyJob_txtSecondName")).sendKeys("Surname");
    driver.findElement(By.id("ctl00_ctl00_cphMain_cphMain_ucApplyJob_txtPhone")).clear();    
    driver.findElement(By.id("ctl00_ctl00_cphMain_cphMain_ucApplyJob_txtPhone")).sendKeys("12345678");
    driver.findElement(By.id("ctl00_ctl00_cphMain_cphMain_ucApplyJob_txtEmail")).clear();
    driver.findElement(By.id("ctl00_ctl00_cphMain_cphMain_ucApplyJob_txtEmail")).sendKeys("email@gmail.com");
   // Upload CV not logged in
    driver.findElement(By.id("ctl00_ctl00_cphMain_cphMain_ucApplyJob_fileCV")).sendKeys("C:\\Users\\Desktop\\CV_TEST.docx");
    driver.findElement(By.linkText("Open")).click();
    //submit application
    driver.findElement(By.id("ctl00_ctl00_cphMain_cphMain_ucApplyJob_btnSubmit")).click();
}
}

IJ_Test.java

package com.example.tests;

import org.junit.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;

public class IJ_test {
IJ_ApplyForJob afj = new IJ_ApplyForJob();
IJ_CommonSetup setup = new IJ_CommonSetup();
private WebDriver driver = new FirefoxDriver();

@Test
 public void runTest() throws Exception {
  setup.setUp(driver);
  setup.clearCookies(driver);
 afj.SFJ_HomeSearchBoxNotLoggedIn(driver);
  //afj.SFJ_HomeSearchBoxLoggedIn(driver);
  setup.tearDown();
}

}

どこが間違っているのかよくわからないので、助けていただければ幸いです。

4

1 に答える 1