<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="FreesunPortal" basedir="." default="compile">
<!-- ===============Initialize property============================ -->
<property name="ws.home" value="${basedir}"/>
<property name="ws.jars" value="E:\Automation\Jar files\Jars"/>
<property name="test.dest" value="${ws.home}/build"/>
<property name="test.src" value="${ws.home}/src"/>
<property name="ng.result" value="test-output" />
<property name="src.dir" location="src" />
<property name="build.dir" location="bin" />
<presetdef name="javac">
<javac includeantruntime="false" />
</presetdef>
<target name="setClassPath" unless="test.classpath">
<path id="classpath_jars">
<fileset dir="${ws.jars}" includes="*.jar"/>
<pathelement path="${class.path}" />
</path>
<pathconvert pathsep=":" property="test.classpath" refid="classpath_jars" />
</target>
<target name="init" depends="setClassPath">
<condition property="ANT"
value="${env.ANT_HOME}/bin/ant.bat"
else="${env.ANT_HOME}/bin/ant">
<os family="windows" />
</condition>
</target>
<target name="clean">
<delete dir="${test.dest}"/>
</target>
<!--compile-->
<target name="compile" >
<delete includeemptydirs="true">
<fileset dir="${test.dest}" includes ="**//**"/>
</delete>
<mkdir dir="${test.dest}"/>
<path id="compile.classpath">
<fileset dir="E:\Automation\Jar files\Jars">
<include name="**/*.jar"/>
</fileset>
</path>
<echo message="compiling.........."/>
<javac
debug="true"
destdir="${test.dest}"
srcdir="${test.src}"
classpath="${test.classpath}"
>
</javac>
</target>
<target name="run" depends="compile">
<testng classpathref="${test.classpath}:${test.dest}">
<xmlfileset dir="${ws.home}" includes="testng.xml"/>
</testng>
</target>
</project>
Buildfile: E:\Automation\PowerElectronicsWorkShop\FreesunPortal\build.xml
Trying to override old definition of task javac
compile:
[mkdir] Created dir: E:\Automation\PowerElectronicsWorkShop\FreesunPortal\build
[echo] compiling..........
[javac] Compiling 5 source files to E:\Automation\PowerElectronicsWorkShop\FreesunPortal\build
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\addPlantTestRun\PlantTest.java:5: error: package org.testng.annotations does not exist
[javac] import org.testng.annotations.Test;
[javac] ^
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:6: error: package org.openqa.selenium does not exist
[javac] import org.openqa.selenium.Alert;
[javac] ^
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:7: error: package org.openqa.selenium does not exist
[javac] import org.openqa.selenium.By;
[javac] ^
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:8: error: package org.openqa.selenium.support.ui does not exist
[javac] import org.openqa.selenium.support.ui.ExpectedConditions;
[javac] ^
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:9: error: package org.openqa.selenium.support.ui does not exist
[javac] import org.openqa.selenium.support.ui.Select;
[javac] ^
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:10: error: package org.openqa.selenium.support.ui does not exist
[javac] import org.openqa.selenium.support.ui.WebDriverWait;
[javac] ^
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:11: error: package org.testng does not exist
[javac] import org.testng.Assert;
[javac] ^
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\businessLogicLib\AddPlantLib.java:3: error: package org.openqa.selenium does not exist
[javac] import org.openqa.selenium.By;
[javac] ^
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\businessLogicLib\AddPlantLib.java:4: error: package org.openqa.selenium.support does not exist
[javac] import org.openqa.selenium.support.PageFactory;
[javac] ^
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\businessLogicLib\AddPlantLib.java:8: error: package org.testng does not exist
[javac] import org.testng.Assert;
[javac] ^
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\pagefactory\LoginPage.java:3: error: package org.openqa.selenium does not exist
[javac] import org.openqa.selenium.WebElement;
[javac] ^
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\pagefactory\LoginPage.java:4: error: package org.openqa.selenium.support does not exist
[javac] import org.openqa.selenium.support.FindBy;
[javac] ^
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\pagefactory\LoginPage.java:10: error: cannot find symbol
[javac] private WebElement userNameEdt;
[javac] ^
[javac] symbol: class WebElement
[javac] location: class LoginPage
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\pagefactory\LoginPage.java:13: error: cannot find symbol
[javac] private WebElement passwordEdt;
[javac] ^
[javac] symbol: class WebElement
[javac] location: class LoginPage
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\pagefactory\LoginPage.java:16: error: cannot find symbol
[javac] private WebElement loginButton;
[javac] ^
[javac] symbol: class WebElement
[javac] location: class LoginPage
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\pagefactory\LoginPage.java:19: error: cannot find symbol
[javac] private WebElement logo;
[javac] ^
[javac] symbol: class WebElement
[javac] location: class LoginPage
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\pagefactory\LoginPage.java:21: error: cannot find symbol
[javac] public WebElement getUserNameEdt() {
[javac] ^
[javac] symbol: class WebElement
[javac] location: class LoginPage
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\pagefactory\LoginPage.java:25: error: cannot find symbol
[javac] public WebElement getPasswordEdt() {
[javac] ^
[javac] symbol: class WebElement
[javac] location: class LoginPage
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\pagefactory\LoginPage.java:29: error: cannot find symbol
[javac] public WebElement getLoginButton() {
[javac] ^
[javac] symbol: class WebElement
[javac] location: class LoginPage
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\pagefactory\LoginPage.java:33: error: cannot find symbol
[javac] public WebElement getLogo() {
[javac] ^
[javac] symbol: class WebElement
[javac] location: class LoginPage
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\DriverLib.java:3: error: package org.openqa.selenium.firefox does not exist
[javac] import org.openqa.selenium.firefox.FirefoxDriver;
[javac] ^
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\DriverLib.java:4: error: package org.openqa.selenium does not exist
[javac] import org.openqa.selenium.WebDriver;
[javac] ^
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\DriverLib.java:9: error: cannot find symbol
[javac] public static WebDriver driver = new FirefoxDriver();
[javac] ^
[javac] symbol: class WebDriver
[javac] location: class DriverLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\addPlantTestRun\PlantTest.java:20: error: cannot find symbol
[javac] @Test
[javac] ^
[javac] symbol: class Test
[javac] location: class PlantTest
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\pagefactory\LoginPage.java:9: error: cannot find symbol
[javac] @FindBy(id = "username")
[javac] ^
[javac] symbol: class FindBy
[javac] location: class LoginPage
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\pagefactory\LoginPage.java:12: error: cannot find symbol
[javac] @FindBy(id = "password")
[javac] ^
[javac] symbol: class FindBy
[javac] location: class LoginPage
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\pagefactory\LoginPage.java:15: error: cannot find symbol
[javac] @FindBy(id = "go")
[javac] ^
[javac] symbol: class FindBy
[javac] location: class LoginPage
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\pagefactory\LoginPage.java:18: error: cannot find symbol
[javac] @FindBy(id = "img-logo")
[javac] ^
[javac] symbol: class FindBy
[javac] location: class LoginPage
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:26: error: cannot find symbol
[javac] WebDriverWait wait = new WebDriverWait(DriverLib.driver, 20);
[javac] ^
[javac] symbol: class WebDriverWait
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:26: error: cannot find symbol
[javac] WebDriverWait wait = new WebDriverWait(DriverLib.driver, 20);
[javac] ^
[javac] symbol: class WebDriverWait
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:27: error: cannot find symbol
[javac] wait.until(ExpectedConditions.presenceOfElementLocated(By.linkText(linkName)));
[javac] ^
[javac] symbol: variable By
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:27: error: cannot find symbol
[javac] wait.until(ExpectedConditions.presenceOfElementLocated(By.linkText(linkName)));
[javac] ^
[javac] symbol: variable ExpectedConditions
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:33: error: cannot find symbol
[javac] WebDriverWait wait = new WebDriverWait(DriverLib.driver, 20);
[javac] ^
[javac] symbol: class WebDriverWait
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:33: error: cannot find symbol
[javac] WebDriverWait wait = new WebDriverWait(DriverLib.driver, 20);
[javac] ^
[javac] symbol: class WebDriverWait
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:34: error: cannot find symbol
[javac] wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(xpath)));
[javac] ^
[javac] symbol: variable By
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:34: error: cannot find symbol
[javac] wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(xpath)));
[javac] ^
[javac] symbol: variable ExpectedConditions
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:40: error: cannot find symbol
[javac] WebDriverWait wait = new WebDriverWait(DriverLib.driver, 20);
[javac] ^
[javac] symbol: class WebDriverWait
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:40: error: cannot find symbol
[javac] WebDriverWait wait = new WebDriverWait(DriverLib.driver, 20);
[javac] ^
[javac] symbol: class WebDriverWait
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:41: error: cannot find symbol
[javac] wait.until(ExpectedConditions.presenceOfElementLocated(By.id(id)));
[javac] ^
[javac] symbol: variable By
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:41: error: cannot find symbol
[javac] wait.until(ExpectedConditions.presenceOfElementLocated(By.id(id)));
[javac] ^
[javac] symbol: variable ExpectedConditions
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:47: error: cannot find symbol
[javac] WebDriverWait wait = new WebDriverWait(DriverLib.driver, 20);
[javac] ^
[javac] symbol: class WebDriverWait
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:47: error: cannot find symbol
[javac] WebDriverWait wait = new WebDriverWait(DriverLib.driver, 20);
[javac] ^
[javac] symbol: class WebDriverWait
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:48: error: cannot find symbol
[javac] wait.until(ExpectedConditions.presenceOfElementLocated(By.name(wbName)));
[javac] ^
[javac] symbol: variable By
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:48: error: cannot find symbol
[javac] wait.until(ExpectedConditions.presenceOfElementLocated(By.name(wbName)));
[javac] ^
[javac] symbol: variable ExpectedConditions
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:56: error: cannot find symbol
[javac] String actPage = DriverLib.driver.findElement(By.xpath(textXpath)).getText();
[javac] ^
[javac] symbol: variable By
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:91: error: cannot find symbol
[javac] Select sel = new Select(DriverLib.driver.findElement(By.id(selIdName)));
[javac] ^
[javac] symbol: class Select
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:91: error: cannot find symbol
[javac] Select sel = new Select(DriverLib.driver.findElement(By.id(selIdName)));
[javac] ^
[javac] symbol: class Select
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:91: error: cannot find symbol
[javac] Select sel = new Select(DriverLib.driver.findElement(By.id(selIdName)));
[javac] ^
[javac] symbol: variable By
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:98: error: cannot find symbol
[javac] Select sel = new Select(DriverLib.driver.findElement(By.id(selIdName)));
[javac] ^
[javac] symbol: class Select
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:98: error: cannot find symbol
[javac] Select sel = new Select(DriverLib.driver.findElement(By.id(selIdName)));
[javac] ^
[javac] symbol: class Select
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:98: error: cannot find symbol
[javac] Select sel = new Select(DriverLib.driver.findElement(By.id(selIdName)));
[javac] ^
[javac] symbol: variable By
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:105: error: cannot find symbol
[javac] Select sel = new Select(DriverLib.driver.findElement(By.id(selIdName)));
[javac] ^
[javac] symbol: class Select
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:105: error: cannot find symbol
[javac] Select sel = new Select(DriverLib.driver.findElement(By.id(selIdName)));
[javac] ^
[javac] symbol: class Select
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:105: error: cannot find symbol
[javac] Select sel = new Select(DriverLib.driver.findElement(By.id(selIdName)));
[javac] ^
[javac] symbol: variable By
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:112: error: cannot find symbol
[javac] Alert alert = DriverLib.driver.switchTo().alert();
[javac] ^
[javac] symbol: class Alert
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:119: error: cannot find symbol
[javac] Alert alert = DriverLib.driver.switchTo().alert();
[javac] ^
[javac] symbol: class Alert
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\CommonUtilLib.java:127: error: cannot find symbol
[javac] Assert.assertEquals(actText, expText, message);
[javac] ^
[javac] symbol: variable Assert
[javac] location: class CommonUtilLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\businessLogicLib\AddPlantLib.java:17: error: cannot find symbol
[javac] LoginPage login = PageFactory.initElements(DriverLib.driver, LoginPage.class);
[javac] ^
[javac] symbol: variable PageFactory
[javac] location: class AddPlantLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\businessLogicLib\AddPlantLib.java:40: error: cannot find symbol
[javac] String actText = DriverLib.driver.findElement(By.xpath("//h3[text()='Last Faults']")).getText();
[javac] ^
[javac] symbol: variable By
[javac] location: class AddPlantLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\businessLogicLib\AddPlantLib.java:42: error: cannot find symbol
[javac] Assert.assertEquals(actText, expText, "page is not verified");
[javac] ^
[javac] symbol: variable Assert
[javac] location: class AddPlantLib
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\genericfunctionLib\DriverLib.java:9: error: cannot find symbol
[javac] public static WebDriver driver = new FirefoxDriver();
[javac] ^
[javac] symbol: class FirefoxDriver
[javac] location: class DriverLib
[javac] 61 errors
BUILD FAILED
E:\Automation\PowerElectronicsWorkShop\FreesunPortal\build.xml:62: Compile failed; see the compiler error output for details.
Total time: 1 second
请帮帮我们。
答案 0 :(得分:1)
这是由 javac 任务发出的编译错误。
[javac] E:\Automation\PowerElectronicsWorkShop\FreesunPortal\src\com\freesunPortal\addPlantTestRun\PlantTest.java:5: error: package org.testng.annotations does not exist
[javac] import org.testng.annotations.Test;
表示您的类路径缺少testng.jar。
我建议简化类路径管理。在顶部声明路径
<path id="compile.path">
<fileset dir="${compile.lib.dir}" includes="*.jar"/>
<pathelement location="${classes.dir}"/>
</path>
<path id="test.path">
<path refid="compile.path"/>
<fileset dir="${test.lib.dir}" includes="*.jar"/>
</path>
<path id="runtime.path">
<path refid="test.path"/>
<fileset dir="${test.lib.dir}" includes="*.jar"/>
</path>
然后将它们用作支持它们的各种任务的参考:
<javac ... classpathref="${compile.path}"/>
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<path refid="test.path"/>
</classpath>
<java ... classpathref="${runtime.path}"/>
我希望这可以帮助您解决问题。
答案 1 :(得分:0)