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

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

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

面试准备

模拟考试

设为首页

收藏此页面

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

面试题与答案

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

共 40 道题 面试题与答案

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

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

面试题与答案

搜索问题以查看答案。

中级 / 1 到 5 年经验级别面试题与答案

问题 1

What do you mean by XPath?

XPath is also defined as XML Path. It is a language used to query XML documents. It is an important approach to locate elements in Selenium. XPath consists of a path expression along with some conditions. Here, we can easily write XPath script/query to locate any element in the webpage. It is developed to allow the navigation of XML documents. The key factors that it considered while navigating are selecting individual elements, attributes, or some other part of an XML document for specific processing. It also produces reliable locators. Some other points about XPath are as follows.

  • XPath is a language used for locating nodes in XML documents.
  • XPath can be used as a substitute when you don't have a suitable id or name attribute for the element you want to locate.
  • XPath provides locating strategies like:
    • XPath Absolute
    • XPath Attributes
保存以便复习

保存以便复习

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

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

Explain XPath Absolute and XPath attributes.

XPath Absolute:

  • XPath Absolute enables users to mention the complete XPath location from the root HTML tag to the specific elements.
  • Syntax: //html/body/tag1[index]/tag2[index]/.../tagN[index]
  • Example: //html/body/div[2]/div/div[2]/div/div/div/fieldset/form/div[1]/input[1]

XPath Attributes:

  • XPath Attributes is always recommended when you don't have a suitable id or name attribute for the element you want to locate.
  • Syntax: //htmltag[@attribute1='value1' and @attribute2='value2']
  • Example: //input[@id='passwd' and @placeholder='password']
保存以便复习

保存以便复习

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

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

What is the difference between "type" and "typeAndWait" command?

"type" command is used to type keyboard key values into the text box of software web application. It can also be used for selecting values of combo box whereas "typeAndWait" command is used when your typing is completed and software web page start reloading. This command will wait for software application page to reload. If there is no page reload event on typing, you have to use a simple "type" command.

保存以便复习

保存以便复习

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

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

What is the difference between findElement() and findElements()?

findElement(): It is used to find the first element within the current page using the given "locating mechanism". It returns a single WebElement.

findElements(): It uses the given "locating mechanism" to find all the elements within the current page. It returns a list of web elements.

保存以便复习

保存以便复习

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

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

What is the wait? How many types of waits in selenium?

Selenium Webdriver introduces the concept of waits for the AJAX-based application. There are two types of waits:

  1. Implicit Wait
  2. Explicit Wait
保存以便复习

保存以便复习

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

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

What is the main disadvantage of implicit wait?

The main disadvantage of implicit wait is that it slows down test performance.

Another disadvantage of implicit wait is:

Suppose, you set the waiting limit to be 10 seconds, and the elements appear in the DOM in 11 seconds, your tests will be failed because you told it to wait a maximum of 10 seconds.

保存以便复习

保存以便复习

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

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

What is Selenium Grid?

Selenium Grid facilitates you to distribute your tests on multiple machines and all of them at the same time. So, you can execute tests on Internet Explorer on Windows and Safari on Mac machine using the same text script. It reduces the time of test execution and provides quick feedback.

保存以便复习

保存以便复习

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

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

How can we launch different browsers in Selenium WebDriver?

We have to create an instance of a driver of that particular browser.

 

WebDriver driver =newFirefoxDriver();  

Here, "WebDriver" is an interface, and we are creating a reference variable "driver" of type WebDriver, instantiated using "FireFoxDriver" class.

保存以便复习

保存以便复习

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

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

Write a code snippet to launch Firefox browser in WebDriver.

public class FirefoxBrowserLaunchDemo {  
  
 public static void main(String[] args) {  
  
  //Creating a driver object referencing WebDriver interface  
  WebDriver driver;  
  
  //Setting webdriver.gecko.driver property  
  System.setProperty("webdriver.gecko.driver", pathToGeckoDriver + "\\geckodriver.exe");  
  
  //Instantiating driver object and launching browser  
  driver = newFirefoxDriver();  
  
  //Using get() method to open a webpage  
  driver.get("http://javatpoint.com");  
  
  //Closing the browser  
  driver.quit();  
  
 }  
  
}  

保存以便复习

保存以便复习

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

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

Write a code snippet to launch Chrome browser in WebDriver.

public class ChromeBrowserLaunchDemo {  
  
  public static void main(String[] args) {  
  
    //Creating a driver object referencing WebDriver interface  
    WebDriver driver;  
  
    //Setting the webdriver.chrome.driver property to its executable's location  
    System.setProperty("webdriver.chrome.driver", "/lib/chromeDriver/chromedriver.exe");  
      
    //Instantiating driver object  
    driver = newChromeDriver();  
  
    //Using get() method to open a webpage  
    driver.get("http://javatpoint.com");  
  
    //Closing the browser  
    driver.quit();  
  
  }  
}  

保存以便复习

保存以便复习

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

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

Write a code snippet to launch Internet Explorer browser in WebDriver.

public class IEBrowserLaunchDemo {  
  
  public static void main(String[] args) {  
  
    //Creating a driver object referencing WebDriver interface  
    WebDriver driver;  
  
    //Setting the webdriver.ie.driver property to its executable's location  
    System.setProperty("webdriver.ie.driver", "/lib/IEDriverServer/IEDriverServer.exe");  
      
    //Instantiating driver object  
    driver = newInternetExplorerDriver();  
  
    //Using get() method to open a webpage  
    driver.get("http://javatpoint.com");  
  
    //Closing the browser  
    driver.quit();  
  
  }  
  
}  

保存以便复习

保存以便复习

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

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

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

版权所有 © 2026,WithoutBook。