Код: Выделить всё
public void clickOnDownloadBtn() {
UIPageAction UIPgAct = new UIPageAction();
UIPgAct.clickBtnByButtonLabel("Download Button group with a nested menu");
commonLoginPom.waitForLoadingImageIsNotPresent();
waitForAlertMessage("Download");
}
Код: Выделить всё
public void verifyDownloadedFile(String fileType) {
String dateAndTime = UIPgAct.getSpecificDate(0,"yyyyMMddHHmm");
String expFileName = "dartts-search-"+dateAndTime;
JavascriptExecutor js = (JavascriptExecutor)driver;
String contentDisposition = (String) js.executeScript("return arguments[0].getResponseHeader('Content-Disposition');", driver.findElement(By.tagName("body"))); //here is the exception that is thrown
String filename = "";
if (contentDisposition != null) {
String[] parts = contentDisposition.split(";");
for (String part : parts) {
if (part.trim().startsWith("filename")) {
filename = part.split("=")[1].trim().replaceAll("\"", "");
break;
}
}
logger.info("File name is "+filename);
}
}
org.openqa.selenium.JavascriptException: ошибка javascript:
arguments[0].getResponseHeader не является функцией (информация о сеансе:
chrome=122.0.6261.69) Информация о сборке: версия: '4.26.0', редакция:
'8ccf0219d7' Информация о системе: os.name: 'Windows 11', os.arch: 'amd64',
os.version: '10.0', java.version: '17.0.8' Информация о драйвере:org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$Juadff3R$ByteBuddy$SBnWYgkD
Команда: [3f87c1092c0fe1ddd23a59697666d2bb, ExecuteScript
{args=[{element-6066-11e4-a52e-4f735466cecf=f.C9CDA9F3320EF6FD01EFEB826B056B33.d.DDC4FA9BCE14C3E0BD3747C7CBD788C1.e.190}],
script=return аргументы[0].getResponseHeader('Content-Disposition');}]
Возможности {acceptInsecureCerts: false, имя браузера: chrome,
browserVersion: 122.0.6261.69, chrome: {chromedriverVersion:
122.0 .6261,69 (81bc525b6a36..., userDataDir: /tmp/.org.chromium.Chromium...}, Fedcm:accounts: true,
goog:chromeOptions: {debuggerAddress: localhost:9222},
networkConnectionEnabled: false, pageLoadStrategy: нормальный,
Имя платформы: linux, прокси: Proxy(), se:bidiEnabled: false, se:cdp:
ws://selenium-grid.raven-ek..., se:cdpVersion: 122.0.6261.69, se:vnc:
ws://selenium-grid.raven-ek..., se: vncEnabled: true,
se:vncLocalAddress: ws://100.64.56.255:7900, setWindowRect: true,
strictFileInteractability: false, таймауты: {implicit: 0, pageLoad:
300000, script: 30000}, unhandledPromptBehavior: отклонить и уведомить,
webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true,
webauthn:extension:minPinLength: true, webauthn:extension:prf: true,
webauthn:virtualAuthenticators: true} Идентификатор сеанса:
3f87c1092c0fe1ddd23a59697666d2bb at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method) at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
в
java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at
java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499 )
в
java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at org.openqa.selenium.remote.ErrorCodec.decode(ErrorCodec.java:167)
at
org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:138)
at
org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec .java:50)
Подробнее здесь: https://stackoverflow.com/questions/793 ... tion-error
Мобильная версия