File tree 1 file changed +17
-1
lines changed
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -1864,6 +1864,19 @@ class WebDriver extends Helper {
1864
1864
*/
1865
1865
async waitForEnabled ( locator , sec = null ) {
1866
1866
const aSec = sec || this . options . waitForTimeout ;
1867
+ if ( isWebDriver5 ( ) ) {
1868
+ return this . browser . waitUntil ( async ( ) => {
1869
+ const res = await this . $$ ( withStrictLocator ( locator ) ) ;
1870
+ if ( ! res || res . length === 0 ) {
1871
+ return false ;
1872
+ }
1873
+ const selected = await forEachAsync ( res , async el => this . browser . isElementEnabled ( getElementId ( el ) ) ) ;
1874
+ if ( Array . isArray ( selected ) ) {
1875
+ return selected . filter ( val => val === true ) . length > 0 ;
1876
+ }
1877
+ return selected ;
1878
+ } , aSec * 1000 , `element (${ new Locator ( locator ) } ) still not enabled after ${ aSec } sec` ) ;
1879
+ }
1867
1880
return this . browser . waitUntil ( async ( ) => {
1868
1881
const res = await this . $$ ( withStrictLocator ( locator ) ) ;
1869
1882
if ( ! res || res . length === 0 ) {
@@ -1874,7 +1887,10 @@ class WebDriver extends Helper {
1874
1887
return selected . filter ( val => val === true ) . length > 0 ;
1875
1888
}
1876
1889
return selected ;
1877
- } , aSec * 1000 , `element (${ new Locator ( locator ) } ) still not enabled after ${ aSec } sec` ) ;
1890
+ } , {
1891
+ timeout : aSec * 1000 ,
1892
+ timeoutMsg : `element (${ new Locator ( locator ) } ) still not enabled after ${ aSec } sec` ,
1893
+ } ) ;
1878
1894
}
1879
1895
1880
1896
/**
You can’t perform that action at this time.
0 commit comments