@@ -2492,24 +2492,22 @@ class Playwright extends Helper {
24922492 const context = await this . context
24932493 const matchedLocator = new Locator ( select )
24942494
2495- // Strict locator
24962495 if ( ! matchedLocator . isFuzzy ( ) ) {
24972496 this . debugSection ( 'SelectOption' , `Strict: ${ JSON . stringify ( select ) } ` )
24982497 const els = await this . _locate ( matchedLocator )
24992498 assertElementExists ( els , select , 'Selectable element' )
25002499 return proceedSelect . call ( this , context , els [ 0 ] , option )
25012500 }
25022501
2503- // Fuzzy: try combobox
25042502 this . debugSection ( 'SelectOption' , `Fuzzy: "${ matchedLocator . value } "` )
2505- let els = await findByRole ( context , { role : 'combobox' , name : matchedLocator . value } )
2506- if ( els ?. length ) return proceedSelect . call ( this , context , els [ 0 ] , option )
2503+ const literal = xpathLocator . literal ( matchedLocator . value )
25072504
2508- // Fuzzy: try listbox
2509- els = await findByRole ( context , { role : 'listbox' , name : matchedLocator . value } )
2510- if ( els ?. length ) return proceedSelect . call ( this , context , els [ 0 ] , option )
2505+ let els = await this . _locate ( { xpath : Locator . select . narrow ( literal ) } )
2506+ if ( els . length ) return proceedSelect . call ( this , context , els [ 0 ] , option )
2507+
2508+ els = await this . _locate ( { xpath : Locator . select . wide ( literal ) } )
2509+ if ( els . length ) return proceedSelect . call ( this , context , els [ 0 ] , option )
25112510
2512- // Fuzzy: try native select
25132511 els = await findFields . call ( this , select )
25142512 assertElementExists ( els , select , 'Selectable element' )
25152513 return proceedSelect . call ( this , context , els [ 0 ] , option )
@@ -2559,6 +2557,10 @@ class Playwright extends Helper {
25592557 *
25602558 */
25612559 async see ( text , context = null ) {
2560+ // If only one argument passed and it's an object without custom toString(), treat as locator
2561+ if ( ! context && text && typeof text === 'object' && ! Array . isArray ( text ) && text . toString === Object . prototype . toString ) {
2562+ return this . seeElement ( text )
2563+ }
25622564 return proceedSee . call ( this , 'assert' , text , context )
25632565 }
25642566
@@ -4630,7 +4632,7 @@ async function proceedSelect(context, el, option) {
46304632 const role = await el . getAttribute ( 'role' )
46314633 const options = Array . isArray ( option ) ? option : [ option ]
46324634
4633- if ( role === 'combobox' ) {
4635+ if ( role === 'combobox' || role === 'button' ) {
46344636 this . debugSection ( 'SelectOption' , 'Expanding combobox' )
46354637 await highlightActiveElement . call ( this , el )
46364638 const [ ariaOwns , ariaControls ] = await Promise . all ( [ el . getAttribute ( 'aria-owns' ) , el . getAttribute ( 'aria-controls' ) ] )
0 commit comments