enter image description here下面是我编写的脚本,它在初始步骤中运行良好,但它开始停止工作,必须单击它并打开一个弹出框,在该框中必须发送密钥并单击关。xpath selenium中的Java脚本错误
package pages;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
import appSetup_Maven.test.BaseClass;
public class UploadFile extends BaseClass {
@Test
public void logout() throws IOException {
Login();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
}
@Test
public void uploadFile() throws Exception {
driver.findElement(By.xpath(".//*[@id='sidebar-menu']/ul/li[5]/a/span[1]")).click();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.findElement(By.xpath(".//*[@id='sidebar-menu']/ul/li[5]/ul/li[4]/a/span")).click();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.findElement(By.xpath(".//*[@id='drives-gridview']/table/tbody/tr[1]/td[1]/a")).click();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.findElement(By.xpath(".//*[@id='wrapper']/div[3]/div/div[2]/div[2]/div/div[2]/div/a[1]")).click();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.findElement(By.xpath(".//*[@id='explorer-content']/div[2]/div/div/div/div[2]/div/div[1]/div/div[1]/button[2]")).click();
driver.findElement(By.xpath(".//*[@id='folderName']")).sendKeys("Test");
driver.findElement(By.xpath(".//*[@id='folderName']")).sendKeys("Test");
driver.findElement(By.xpath(".//*[@id='createFolderForm']/div[3]/button[2]")).click();
}
在执行上面的代码中,我得到这个错误:
JavaScript warning: www.wwwww.com/assets/js/clipboard.min.js, line 1: mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create ************************************************************ * Call to xpconnect wrapped JSObject produced this error: * [Exception... "[object Object]'[object Object]' when calling method: [nsIConsoleListener::observe]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "native frame :: :: :: line 0" data: no] ************************************************************ ************************************************************ * Call to xpconnect wrapped JSObject produced this error: * [Exception... "[object Object]'[object Object]' when calling method: [nsIConsoleListener::observe]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "native frame :: :: :: line 0" data: no] ************************************************************ JavaScript warning: , line 0: https://hq20m-161112.wwww.com:10036/js/iframeResizer.contentWindow.min.js is being assigned a //# sourceMappingURL, but already has one ************************************************************ * Call to xpconnect wrapped JSObject produced this error: * [Exception... "[object Object]'[object Object]' when calling method: [nsIConsoleListener::observe]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "native frame :: :: :: line 0" data: no] ************************************************************
Not sure why i am getting this error. All i am trying to do is to click an element on the webpage, enter text in the popup and click the button on the popup to close that popup box.
“HTML”代码在哪里? –