-->

Featured

DSA Interview Question

Question: Various S orting algorithms Answer: There are various sorting algorithms, each with its own advantages and disadvantages in terms ...

WebdriverIO MCQ

Question : Which command is used to maximize the browser window in WebdriverIO?

browser.maximizeWindow()

browser.maximize()

browser.windowMaximize()

browser.window().maximize()

Correct Answer : browser.maximizeWindow()


Question : How can you select an element by its attribute value in WebdriverIO?

$('attribute=value')

$('*[attribute=value]')

$('element[attribute=value]')

browser.getAttribute('element', 'attribute=value')

Correct Answer : $('element[attribute=value]')


Question : Which command is used to simulate keyboard input in WebdriverIO?

browser.keys()

browser.type()

browser.keyboard()

browser.sendKeys()

Correct Answer : browser.keys()


Question : How can you check if an element is displayed on the page in WebdriverIO?

element.isDisplayed()

element.isVisible()

element.displayed()

element.visible()

Correct Answer : element.isDisplayed()


Question : Which hook in WebdriverIO is executed after all the specs are done?

afterTest()

onComplete()

after()

afterAll()

Correct Answer : onComplete()


Question : What command is used to switch to a different frame in WebdriverIO?

switchToFrame()

frame()

switchFrame()

selectFrame()

Correct Answer : switchToFrame()


Question : How can you retrieve the URL of the current page in WebdriverIO?

browser.currentUrl()

browser.getUrl()

browser.getCurrentUrl()

browser.url()

Correct Answer : browser.getUrl()


Question : Which assertion library is commonly used with WebdriverIO?

Chai

Mocha

Jasmine

Jest

Correct Answer : Chai


Question : How do you execute a command asynchronously in WebdriverIO?

Using await

Using async

Using then()

Using async/await

Correct Answer : Using async/await


Question : What command is used to accept an alert in WebdriverIO?

alert.accept()

browser.alertAccept()

browser.acceptAlert()

browser.dismissAlert()

Correct Answer : browser.acceptAlert()


Question : Which command is used to save a screenshot in WebdriverIO?

browser.captureScreenshot()

browser.takeScreenshot()

browser.saveScreenshot()

browser.screenshot()

Correct Answer : browser.saveScreenshot()


Question : How do you pause the execution of a test in WebdriverIO?

browser.pause()

browser.wait()

browser.sleep()

browser.hold()

Correct Answer : browser.pause()


Question : Which command is used to execute JavaScript code in WebdriverIO?

browser.executeScript()

browser.runScript()

browser.executeJavaScript()

browser.evalScript()

Correct Answer : browser.executeScript()


Question : How do you set a cookie in WebdriverIO?

browser.setCookies()

browser.cookie()

browser.addCookie()

browser.setCookieValue()

Correct Answer : browser.setCookies()


Question : Which command is used to simulate mouse actions in WebdriverIO?

browser.mouse()

browser.performMouseAction()

browser.action()

browser.simulateMouse()

Correct Answer : browser.action()


Question : How can you wait for an element to be clickable in WebdriverIO?

waitForClickable()

waitUntilClickable()

waitForElementClickable()

waitClickable()

Correct Answer : waitForClickable()


Question : What command is used to scroll to an element in WebdriverIO?

scrollTo()

element.scrollIntoView()

browser.scroll()

browser.scrollToElement()

Correct Answer : element.scrollIntoView()


Question : How can you perform a drag-and-drop operation in WebdriverIO?

Using browser.dragAndDrop()

Using dragAndDrop()

Using dragAndDropBy()

Using browser.dragAndDropElement()

Correct Answer : Using dragAndDrop()


Question : Which command is used to close the current browser window in WebdriverIO?

browser.close()

browser.closeWindow()

browser.quit()

browser.exit()

Correct Answer : browser.close()


Question : How can you wait for a specific condition to be true in WebdriverIO?

Using browser.waitForCondition()

Using browser.waitUntil()

Using browser.waitFor()

Using browser.waitCondition()

Correct Answer : Using browser.waitUntil()


Question : Which command is used to open a new browser window in WebdriverIO?

browser.openWindow()

browser.newWindow()

browser.window.open()

browser.newTab()

Correct Answer : browser.newWindow()


Question : How do you get the text content of an element in WebdriverIO?

element.getText()

element.textContent()

element.text()

element.getTextContent()

Correct Answer : element.getText()


Question : Which command is used to clear the value of an input field in WebdriverIO?

element.clear()

element.clearValue()

element.value.clear()

element.delete()

Correct Answer : element.clearValue()


Question : How can you switch to a different window handle in WebdriverIO?

browser.switchToWindow()

browser.switchTo().window()

browser.window.switchTo()

browser.window().switchTo()

Correct Answer : browser.switchToWindow()


Question : What command is used to get the title of the current page in WebdriverIO?

browser.title()

browser.getTitle()

browser.getCurrentTitle()

browser.pageTitle()

Correct Answer : browser.getTitle()


Question : How do you perform a mouse hover action in WebdriverIO?

browser.moveTo({ xOffset, yOffset })

element.hover(element)

element.moveTo({ xOffset, yOffset })

element.mouseHover(element)

Correct Answer : element.moveTo({ xOffset, yOffset })


Question : How can you get the value of an attribute of an element in WebdriverIO?

element.getAttribute("attributeName")

element.attribute("attributeName")

element.getAttribute()

element.get("getAttribute")

Correct Answer : element.getAttribute("attributeName")


Question : How can you perform a double-click action in WebdriverIO?

element.doubleClick()

browser.doubleClick(element)

browser.doubleClickElement(element)

element.doubleClick().perform()

Correct Answer : element.doubleClick()


Question : Which command is used to switch to the parent frame in WebdriverIO?

browser.switchToParentFrame()

browser.switchTo().parentFrame()

browser.parentFrame()

browser.switchToParent()

Correct Answer : browser.switchToParentFrame()


Question : How do you navigate to a URL in WebdriverIO?

browser.goto()

browser.navigateTo()

browser.url()

browser.navigate()

Correct Answer : browser.url()


Question : What command is used to check if an element is enabled in WebdriverIO?

element.isEnabled()

element.isDisabled()

element.enable()

element.disable()

Correct Answer : element.isEnabled()


Question : Which command is used to retrieve the value of a CSS property of an element in WebdriverIO?

element.getCSSProperty("cssProperty")

element.cssProperty("cssProperty")

element.getStyleProperty("cssProperty")

element.getCSS()

Correct Answer : element.getCSSProperty("cssProperty")


Question : How do you simulate pressing the Enter key in WebdriverIO?

browser.keys('Enter')

browser.keys(['Enter'])

browser.enter()

browser.sendKeys('Enter')

Correct Answer : browser.keys(['Enter'])


Question : Which command is used to switch to a different tab in WebdriverIO?

browser.switchToTab()

browser.switchTo().tab()

browser.switchWindow(matcher)

browser.switchToTab()

Correct Answer : browser.switchWindow(matcher)


Question : What command is used to refresh the current page in WebdriverIO?

browser.refresh()

browser.reload()

browser.pageRefresh()

browser.pageReload()

Correct Answer : browser.refresh()


Question : How can you execute a command at the end of each test suite in WebdriverIO?

Using afterSuite()

Using onComplete()

Using after()

Using afterAll()

Correct Answer : Using afterSuite()


Question : How do you simulate pressing the Tab key in WebdriverIO?

browser.pressTab()

browser.keys(['Tab'])

browser.tab()

browser.sendKeys('Tab')

Correct Answer : browser.keys(['Tab'])


Question : Which command is used to retrieve the size of an element in WebdriverIO?

element.getSize()

element.size()

element.dimension()

element.getDimension()

Correct Answer : element.getSize()


Question : What command is used to set the window size in WebdriverIO?

browser.setWindowSize()

browser.resizeWindow()

browser.window.setSize()

browser.window.resize()

Correct Answer : browser.setWindowSize()


Question : How do you wait for an element to be present in WebdriverIO?

element.waitForExist()

element.waitForPresent()

element.waitForElement()

element.waitUntilPresent()

Correct Answer : element.waitForExist()


Question : How can you retrieve the value of a cookie in WebdriverIO?

browser.getCookie()

browser.cookie()

browser.getCookieValue()

browser.cookieValue()

Correct Answer : browser.getCookie()


Question : What command is used to wait for an element to be visible in WebdriverIO?

element.waitForVisible()

element.isVisible()

element.waitUntilVisible()

element.waitForDisplayed()

Correct Answer : element.waitForDisplayed()


Question : Which command is used to retrieve the tag name of an element in WebdriverIO?

element.getTagName()

element.tagName()

element.tag()

element.getName()

Correct Answer : element.getTagName()

No comments:

Post a Comment

popular posts