@@ -498,60 +498,5 @@ private async Task OnBindingCalledAsync(BindingCalledResponse e)
498498 _logger . LogError ( ex . ToString ( ) ) ;
499499 }
500500 }
501-
502- private async Task < IElementHandle > WaitForSelectorAsync ( string selectorOrXPath , bool isXPath , WaitForSelectorOptions options = null )
503- {
504- options ??= new WaitForSelectorOptions ( ) ;
505- var waitForVisible = options ? . Visible ?? false ;
506- var waitForHidden = options ? . Hidden ?? false ;
507- var timeout = options . Timeout ?? _timeoutSettings . Timeout ;
508-
509- const string predicate = @"function predicate(selectorOrXPath, isXPath, waitForVisible, waitForHidden) {
510- const node = isXPath
511- ? document.evaluate(selectorOrXPath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue
512- : document.querySelector(selectorOrXPath);
513- if (!node)
514- return waitForHidden;
515- if (!waitForVisible && !waitForHidden)
516- return node;
517- const element = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
518-
519- const style = window.getComputedStyle(element);
520- const isVisible = style && style.visibility !== 'hidden' && hasVisibleBoundingBox();
521- const success = (waitForVisible === isVisible || waitForHidden === !isVisible);
522- return success ? node : null;
523-
524- function hasVisibleBoundingBox() {
525- const rect = element.getBoundingClientRect();
526- return !!(rect.top || rect.bottom || rect.width || rect.height);
527- }
528- }" ;
529- var polling = waitForVisible || waitForHidden ? WaitForFunctionPollingOption . Raf : WaitForFunctionPollingOption . Mutation ;
530-
531- using var waitTask = new WaitTask (
532- this ,
533- predicate ,
534- false ,
535- polling ,
536- null , // Polling interval
537- timeout ,
538- options . Root ,
539- null ,
540- new object [ ] { selectorOrXPath , isXPath , options . Visible , options . Hidden } ) ;
541-
542- var handle = await waitTask . Task . ConfigureAwait ( false ) ;
543-
544- if ( handle is not IElementHandle elementHandle )
545- {
546- if ( handle != null )
547- {
548- await handle . DisposeAsync ( ) . ConfigureAwait ( false ) ;
549- }
550-
551- return null ;
552- }
553-
554- return elementHandle ;
555- }
556501 }
557502}
0 commit comments