@@ -2945,35 +2945,6 @@ async function findElements(matcher, locator) {
29452945 return [ ]
29462946}
29472947
2948- /**
2949- * Find a single element using Puppeteer's native element discovery methods
2950- * Note: Puppeteer Locator API doesn't have .first() method like Playwright
2951- * @param {Object } matcher - Puppeteer context to search within
2952- * @param {Object|string } locator - Locator specification
2953- * @returns {Promise<Object> } Single ElementHandle object
2954- */
2955- async function findElement ( matcher , locator ) {
2956- if ( locator . react ) return findReactElements . call ( this , locator )
2957- locator = new Locator ( locator , 'css' )
2958-
2959- // Check if locator is a role locator and call findByRole
2960- if ( locator . isRole ( ) ) {
2961- const elements = await findByRole . call ( this , matcher , locator )
2962- return elements [ 0 ]
2963- }
2964-
2965- // Use proven legacy approach - Puppeteer Locator API doesn't have .first() method
2966- if ( ! locator . isXPath ( ) ) {
2967- const elements = await matcher . $$ ( locator . simplify ( ) )
2968- return elements [ 0 ]
2969- }
2970-
2971- // For XPath in Puppeteer 24.x+, use the same approach as findElements
2972- // $x method was removed, so we use ::-p-xpath() or fallback
2973- const elements = await findElements . call ( this , matcher , locator )
2974- return elements [ 0 ]
2975- }
2976-
29772948/**
29782949 * Find a single element using Puppeteer's native element discovery methods
29792950 * Note: Puppeteer Locator API doesn't have .first() method like Playwright
0 commit comments