热门面试题与答案和在线测试
面向面试准备、在线测试、教程与实战练习的学习平台

通过聚焦学习路径、模拟测试和面试实战内容持续提升技能。

WithoutBook 将分主题面试题、在线练习测试、教程和对比指南整合到一个响应式学习空间中。

面试准备

模拟考试

设为首页

收藏此页面

订阅邮箱地址
首页 / 面试主题 / Selenium
WithoutBook LIVE 模拟面试 Selenium 相关面试主题: 13

面试题与答案

了解热门 Selenium 面试题与答案,帮助应届生和有经验的候选人为求职面试做好准备。

共 40 道题 面试题与答案

面试前建议观看的最佳 LIVE 模拟面试

了解热门 Selenium 面试题与答案,帮助应届生和有经验的候选人为求职面试做好准备。

面试题与答案

搜索问题以查看答案。

资深 / 专家级别面试题与答案

问题 1

Write a code snippet to perform right-click an element in WebDriver.

We will use Action class to generate user event like right-click an element in WebDriver.

Actions action = newActions(driver);  

WebElement element = driver.findElement(By.id("elementId"));  

action.contextClick(element).perform();  

保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 2

Write a code snippet to perform mouse hover in WebDriver.

Actions action = newActions(driver);  

WebElement element = driver.findElement(By.id("elementId"));  

action.moveToElement(element).perform();  

保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 3

How do you perform drag and drop operation in WebDriver?

Code snippet to perform drag and drop operation:

//WebElement on which drag and drop operation needs to be performed  

WebElementfromWebElement = driver.findElement(By Locator of fromWebElement);  

 

//WebElement to which the above object is dropped  

WebElementtoWebElement = driver.findElement(By Locator of toWebElement);  

  

//Creating object of Actions class to build composite actions  

Actions builder = newActions(driver);  

  

//Building a drag and drop action  

Action dragAndDrop = builder.clickAndHold(fromWebElement)  

             .moveToElement(toWebElement)  

             .release(toWebElement)  

         .build();  

  

//Performing the drag and drop action  

dragAndDrop.perform();  

保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 4

What are the different methods to refresh a web page in WebDriver?

There are multiple ways of refreshing a page in Webdriver.

1. Using driver.navigate command -

 

driver.navigate().refresh();  

 

2. Using driver.getCurrentUrl() with driver.get() command -

 

driver.get(driver.getCurrentUrl());  

 

3. Using driver.getCurrentUrl() with driver.navigate() command -

 

driver.navigate().to(driver.getCurrentUrl());  

 

4. Pressing an F5 key on any textbox using the sendKeys command -

 

driver.findElement(By textboxLocator).sendKeys(Keys.F5);  

 

5. Passing ascii value of the F5 key, i.e., "\uE035" using the sendKeys command -

 

driver.findElement(By textboxLocator).sendKeys("\uE035");  

保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 5

Write a code snippet to navigate back and forward in browser history?

Navigate back in browser history:

 

driver.navigate().back();  

 

Navigate forward in browser history:

driver.navigate().forward();  

保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 6

What is POM (Page Object Model)? What are its advantages?

Page Object Model is a design pattern for creating an Object directory for web UI elements. Each web page is required to have its page class. The page class is responsible for finding the WebElements in web pages and then perform operations on WebElements.

The benefits of using POM are as follows:

  • It facilitates with separate operations and flows in the UI from Verification - improves code readability
  • Multiple tests can use the same Object Repository because the Object Repository is independent of Test Cases.
  • Reusability of code
保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论
问题 7

How can you find if an element is displayed on the screen?

WebDriver allows user to check the visibility of the web elements. These web elements can be buttons, radio buttons, drop, checkboxes, boxes, labels etc. which are used with the following methods.

  • isDisplayed()
  • isSelected()
  • isEnabled()

isDisplayed():  

boolean buttonPresence = driver.findElement(By.id("gbqfba")).isDisplayed();  

isSelected():  

boolean buttonSelected = driver.findElement(By.id("gbqfba")).isSelected();  

isEnabled():  

boolean searchIconEnabled = driver.findElement(By.id("gbqfb")).isEnabled();  

保存以便复习

保存以便复习

收藏此条目、标记为困难题,或将其加入复习集合。

打开我的学习资料库
这有帮助吗?
添加评论 查看评论

用户评价最有帮助的内容:

版权所有 © 2026,WithoutBook。