paragraph
'), + } + const mockHelper = { constructor: { name: 'Puppeteer' } } + const webElement = new WebElement(mockElement, mockHelper) + + const html = await webElement.getInnerHTML() + expect(html).to.equal('paragraph
') + }) + }) + + describe('exists()', () => { + it('should work with Playwright helper', async () => { + const mockElement = { + evaluate: fn => Promise.resolve(true), + } + const mockHelper = { constructor: { name: 'Playwright' } } + const webElement = new WebElement(mockElement, mockHelper) + + const exists = await webElement.exists() + expect(exists).to.equal(true) + }) + + it('should work with WebDriver helper', async () => { + const mockElement = {} + const mockHelper = { constructor: { name: 'WebDriver' } } + const webElement = new WebElement(mockElement, mockHelper) + + const exists = await webElement.exists() + expect(exists).to.equal(true) + }) + + it('should work with Puppeteer helper', async () => { + const mockElement = { + evaluate: fn => Promise.resolve(true), + } + const mockHelper = { constructor: { name: 'Puppeteer' } } + const webElement = new WebElement(mockElement, mockHelper) + + const exists = await webElement.exists() + expect(exists).to.equal(true) + }) + + it('should handle errors and return false', async () => { + const mockElement = { + evaluate: () => Promise.reject(new Error('Element not found')), + } + const mockHelper = { constructor: { name: 'Playwright' } } + const webElement = new WebElement(mockElement, mockHelper) + + const exists = await webElement.exists() + expect(exists).to.equal(false) + }) + }) +})