-
Notifications
You must be signed in to change notification settings - Fork 1
/
ShadowRootforDownloadVerification
38 lines (23 loc) · 1.44 KB
/
ShadowRootforDownloadVerification
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import org.openqa.selenium.JavascriptExecutor;
import com.testsigma.customfunc.common.TestsigmaCustomFunctions;
import com.testsigma.customfunc.common.CustomTestStep;
import com.testsigma.customfunc.result.ResultConstants;
import com.testsigma.customfunc.result.TestStepResult;
import com.testsigma.testengine.exceptions.TestsigmaTestdataNotFoundException;
public class ShadowRoot extends TestsigmaCustomFunctions{
@CustomTestStep
public TestStepResult generateOTP(String Path,String filenameforvalidation) throws TestsigmaTestdataNotFoundException {
TestStepResult result= new TestStepResult();
//document.querySelector("body > downloads-manager").shadowRoot.querySelector("#frb0").shadowRoot.querySelector("#file-link").firstChild.nodeValue
JavascriptExecutor jse=(JavascriptExecutor)driver;
String select= (String) jse.executeScript(Path);
if(select.contains(filenameforvalidation)) {
result.setStatus(ResultConstants.SUCCESS);
result.setMessage("Successfully compared the file name "+select+" = "+filenameforvalidation);
}
else {
result.setStatus(ResultConstants.FAILURE);
result.setMessage("Failed to compared the file name "+select+" != "+filenameforvalidation);
}
return result;
}}