java - Cannot find web elements at "chrome://downloads/" page -
i using java , selenium write tests chrome. need chrome://downloads/
, click on clear all
button. can page
remotewebdriver driver = (remotewebdriver) driverchrome; driver.executescript("window.open();"); thread.sleep(500); tabs = new arraylist<string>(driverchrome.getwindowhandles()); driverchrome.switchto().window(tabs.get(1)); thread.sleep(500); driverchrome.get("chrome://downloads/");
but cannot click on button, whatever xpath use says no such element
below here javascriptexecutor
example perform click on clear all
button using selenium :-
javascriptexecutor executor = (javascriptexecutor)driver executor.executescript("var dm = document.getelementsbytagname('downloads-manager')[0];var toolbar = dm.shadowroot.getelementbyid('toolbar');var actions = toolbar.shadowroot.getelementbyid('actions');actions.getelementsbyclassname('clear-all')[0].click();");
tested in chrome version 50.0.2661.102 m
hope you..:)
Comments
Post a Comment