> For the complete documentation index, see [llms.txt](https://qatesting.gitbook.io/qa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://qatesting.gitbook.io/qa/automation-testing/flow/selenium/interview-questions.md).

# Interview Questions

{% embed url="<https://quizlet.com/607287864/selenium-flash-cards/?i=fnawl&x=1jqt>" %}

## Can you list some of the webpage operations available in Selenium?

Me: Sure! Some of the main operations are:

♻️ Navigate to URLs:

```java
driver.get("url") 🖥
driver.navigate().to("url") 🏎️
```

👀 Inspect the webpage:

```java
driver.getTitle() 📃
driver.getPageSource() 👁
driver.getCurrentUrl() 🌐
```

✍️ Interact with elements:

```java
driver.find_element_by_id().send_keys("text") 🔍
driver.find_elements_by_class_name().click() 🖱
```

📷 Take screenshots:

```java
driver.get_screenshot_as_file("filename.png") 📸
```

⌨️ Send keyboard inputs:

```java
Actions().send_keys().perform() 💻
```

🖱 Perform mouse actions:

```java
Actions().move_to_element().click().perform() 🖱
```

## What WebEdit operations are available in Selenium?

Me: WebEdit refers to text fields, input boxes, and text areas on a webpage. Selenium provides these useful APIs to interact with WebEdits:

### To enter text in a text field:

**sendKeys()**

Syntax:

```java
driver.findElement([By.id](<http://by.id/>)("textbox")).sendKeys("TestData")
```

This will type the string "TestData" into the text field. 🔤

### To clear text from a text field:&#x20;

**clear()**

Syntax:

```java
driver.findElement([By.id](<http://by.id/>)("textbox")).clear()
```

This will empty any existing text from the field.✂️

### Entering a search query:

```java
driver.findElement([By.name](<http://by.name/>)("q")).sendKeys("selenium testing") 🔍
```

### Clearing the search box:

```java
driver.findElement([By.name](<http://by.name/>)("q")).clear() ✂️
```

### Filling out a form:

```java
driver.findElement(By.className("fname")).sendKeys("John")
driver.findElement(By.className("lname")).sendKeys("Doe")✍️
```

## What operations can you perform on links using Selenium WebDriver?

Me: Selenium provides a few useful APIs for interacting with links (i.e. \<a> elements):

### To click a link:

**click()**

Syntax:

```java
driver.findElement([By.id](<http://by.id/>)("someLink")).click()
```

This will simulate a click on the link. 👈

### To check if a link is enabled:

**isEnabled()**

Syntax:

```java
driver.findElement([By.id](<http://by.id/>)("link")).isEnabled()
```

This returns true/false if the link can be clicked. 🟢

### To check if a link is visible:&#x20;

**isDisplayed()**

Syntax:

```java
driver.findElement([By.id](<http://by.id/>)("link")).isDisplayed()
```

This returns true/false if the link is visible on the page. 👁️

### Clicking a footer link:

```java
driver.findElement(By.linkText("Terms")).click() 📄
```

### Checking a disabled link:

```java
isEnabled = driver.findElement(By.partialLinkText("Disabled")).isEnabled()
print(isEnabled)  ❌
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://qatesting.gitbook.io/qa/automation-testing/flow/selenium/interview-questions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
