@@ -287,14 +287,23 @@ webdriver.chrome.getPageZoom = function(elem) {
287
287
* on bot.dom.isShown, but with extra intelligence regarding shadow DOM.
288
288
*
289
289
* @param {!Element } elem The element to consider.
290
+ * @param {boolean= } opt_inComposedDom Whether to check if the element is shown
291
+ * within the composed DOM; defaults to false.
290
292
* @param {boolean= } opt_ignoreOpacity Whether to ignore the element's opacity
291
293
* when determining whether it is shown; defaults to false.
292
294
* @return {boolean } Whether or not the element is visible.
293
295
*/
294
- webdriver . chrome . isElementDisplayed = function ( elem , opt_ignoreOpacity ) {
295
- // use bot.dom.isShown to check whether the element is invisible
296
- if ( ! bot . dom . isShown ( elem , opt_ignoreOpacity ) ) {
297
- return false ;
296
+ webdriver . chrome . isElementDisplayed = function ( elem ,
297
+ opt_inComposedDom ,
298
+ opt_ignoreOpacity ) {
299
+ if ( ! ! opt_inComposedDom ) {
300
+ if ( ! bot . dom . isShownInComposedDom ( elem , opt_ignoreOpacity ) ) {
301
+ return false ;
302
+ }
303
+ } else {
304
+ if ( ! bot . dom . isShown ( elem , opt_ignoreOpacity ) ) {
305
+ return false ;
306
+ }
298
307
}
299
308
// if it's not invisible then check if the element is within the shadow DOM
300
309
// of an invisible element, using recursive calls to this function
@@ -304,7 +313,8 @@ webdriver.chrome.isElementDisplayed = function(elem, opt_ignoreOpacity) {
304
313
topLevelNode = topLevelNode . parentNode ;
305
314
}
306
315
if ( topLevelNode instanceof ShadowRoot ) {
307
- return webdriver . chrome . isElementDisplayed ( topLevelNode . host ) ;
316
+ return webdriver . chrome . isElementDisplayed ( topLevelNode . host ,
317
+ opt_inComposedDom ) ;
308
318
}
309
319
}
310
320
// if it's not invisible, or in a shadow DOM, then it's definitely visible
0 commit comments