Selenium IQ

¡Supera tus tareas y exámenes ahora con Quizwiz!

The basic Git workflow goes something like this:

1. You modify files in your working tree. 2. You selectively stage just those changes you want to be part of your next commit, which adds only those changes to the staging area. 3. You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory.

EXAMPLE OF PLUGIN:

<plugin> <groupId>net.masterthought</groupId> <artifactId>maven-cucumber-reporting</artifactId> <version>4.4.0</version> <executions> <execution> <id>execution</id> <phase>verify</phase> <goals> <goal>generate</goal> </goals> <configuration> <projectName>cucumber-jvm-example</projectName> <!-- output directory for the generated report --> <outputDirectory>${project.build.directory}</outputDirectory> <!-- optional, defaults to outputDirectory if not specified --> <inputDirectory>${project.build.directory}</inputDirectory> <jsonFiles> <!-- supports wildcard or name pattern --> <param>**/cucumber.json</param> </jsonFiles> <classificationFiles> <!-- supports wildcard or name pattern --> <param>sample.properties</param> <param>other.properties</param> </classificationFiles> <!--<parallelTesting>false</parallelTesting>--> </configuration> </execution> </executions> </plugin>

In some cases, maximize() will not work > so what will be the way around?

Actions or change version. ChromeOptions options = new ChromeOptions(); options.addArguments("startmaximized");

Where do you see history of a GIT project repository?

After you have created several commits, or if you have cloned a repository with an existing commit history, you'll probably want to look back to see what has happened. The most basic and powerful tool to do this is the git log command.

How do you make sure that all you team members are using the same Selenium version?

As a team, we can utilize Maven, which gives version and build control for team perspective. We have the same version in pom.xml file.

What is a dependency and how do you handle them in your framework?

Dependency is just a Jar file which will be added to the classpath while executing the tasks. I update the dependencies in the POM.xml. I am using dependencies in my framework because of compatibility issues. For example, if the Selenium WebDriver version which I have integrated to my framework is not supportive, I can simply update the dependency file as given below: <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.141.59</version> </dependency> Above, I can simple change the version according the compatibility.

How do you know if your Jenkins build failed?

I click and open my Maven project under Build History. If the icon is in red color, it means the build failed. I can then click and view the details of the failed build and see console logs to view the details/reason of the failure.

Talking about HTML reporting during the interview?

I use maven cucumber reporting. It shows pass/fail statuses for each scenario. It also captures screenshots if test scenario fails.

What type of version control do you use?

I use maven for build generation and git for version control. *Version Control is essential to development. If you make a mistake, it is a simple matter of rolling back to a previous version of your code that you know works. This also frees you to explore and experiment with your code because you are free of having to worry about whether what you are doing is reversible or not.

What is the verification point available in Selenium?

In Selenium WebDriver, There is no built-in features for verification points, it totally depends on external Assertion frameworks such as TestNG or Junit.

How do you configure a job to send an email when Jenkins job execution is complete?

Inside your Jenkins project, Click Configure > Under Post-build Actions select Email Notification and enter your Email Address

What is freestyle job?

Jenkins can be used to perform the typical build server work, such as doing continuous/official/nightly builds, run tests, or perform some repetitive batch tasks. This is called "free-style software project" in Jenkins. Freestyle build jobs are general-purpose build jobs, which provides a maximum of flexibility.

What is Jenkins?

Jenkins is an open-source automation tool written in Java with plugins built for Continuous Integration purposes. Jenkins is used to build and test your software projects continuously making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build

What is a plugin? How do you add plugins in Maven?

Maven is a plugin execution framework, where every task is done by plugins. A plugin generally provides a set of goals, which can be executed using the following: yoll mvn [plugin-name]:[goal-name]

What is POM.XML?

POM stands for Project Object Model. The pom.xml file contains information of project and project configuration information for maven to build the project such as dependencies, build directory, source directory, test source directory, plugin, goals etc. Maven reads the pom.xml file, then executes the goal.

Explain to me your test execution flow with cucumber.

Runner > Feature file > Scenario > Step def > POM

What is the TestNG framework?

TestNG is a testing framework designed to simplify a broad range of testing needs from Unit Testing to Integration Testing. It is an open-source test automation framework for Java.

What annotations are in TestNG that are not in JUnit?

TestNG provides additional annotations compared to JUnit. Such as: @BeforeSuite @BeforeTest @BeforeGroups @AfterGroups @Aftertest @AfterSuite

What is effective POM.xml?

The Effective POM does not exist on your filesystem per se, it's generated on-the-fly whenever your run a Maven build.

What are the different ways to produce reports for TestNG results?

The TestNG library brings a very convenient reporting feature. Once I execute my tests, TestNG generates a test output folder at the root of the project. It combines two kinds of reports. Detailed Report -You can find this report in the <index.html> file. It combines the detailed information like the errors, test groups, execution time, step-by-step logs and TestNG XML file. Summary Report- It is the trimmed version and informs about the no. of "Passed"/" Failed"/"Skipped" cases. You can see it from the <emailable-report.html> file. It's an email friendly report which you can embed and share with the stakeholders. Listener- is defined as an interface that modifies the default TestNG behavior. As the name suggests Listeners "listen" to the event defined in the selenium script and behave accordingly. It is used in selenium by implementing Listeners Interface. It allows customizing TestNG reports or logs.

What is default port for Jenkins?

The default is port 8080

What is staging in GIT?

The staging area is a file, generally contained in your Git directory, that stores information about what will go into your next commit. Its technical name in Git parlance is the "index", but the phrase "staging area" works just as well.

What if there is a dynamic popup that comes up randomly?

Use try/catch with alert

How do you see who updated the class file using GIT?

Using "git log" command

What is Selenium WebDriver?

WebDriver (2.0); is a web automation framework and allows you to execute your tests in different browsers. (2011)

How can you get the log of the reports in Jenkins?

When you are at Jenkins Home > Click Manage Jenkins > Click System Log

How to get all the following siblings of Apple?

Xpath: "//ul/li[contains(text(),'Apple Mobiles')]/followingsibling::li"

How to get all the preceding siblings of Apple?

Xpath: "//ul/li[contains(text(),'Apple Mobiles')]/precedingsibling::li"

How do you create a maven job in Jenkins?

a) Run Jenkins b) Add Maven plugins c) Create a Maven Job d) Specify the location of your Selenium project for example provide the github location e) Click build

What is the difference between commit and push?

git commit- records changes to the repository git push- updates remote repository

How do you integrate Jenkins with Selenium Grid?

https://www.agiletrailblazers.com/blog/modernized-technology/automated-testing-with-selenium-grid- and-jenkins-in-3-steps

How do you integrate Jenkins with Selenium?

https://www.softwaretestinghelp.com/integration-of-jenkins-with-selenium-webdriver/

11. Scroll to element

jse.executeScript("arguments[0].scrollIntoView(true);", element);

For Scroll up:

jse.executeScript("window.scrollBy(0,-250)", "");

For Scroll down:

jse.executeScript("window.scrollBy(0,250)", "");

Maven Plugins are generally used to:

• create jar file • create war file • compile code files • unit testing of code • create project documentation • create project reports

What are the GIT commands?

• git add • git status • git commit • git push • git pull

What are the Maven Phases?

• validate − validate the project is correct and all necessary information is available. • compile − compile the source code of the project. • test − test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed • package − take the compiled code and package it in its distributable format, such as a JAR. • integration-test − process and deploy the package if necessary into an environment where integration tests can be run. • verify − run any checks to verify the package is valid and meets quality criteria. • install − install the package into the local repository, for use as a dependency in other projects locally. • deploy − done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.

How to input text in the text box without calling the sendKeys()?

● //Use javascriptExecutor JavascriptExecutor JS = (JavascriptExecutor)webdriver; ● //To enter username JS.executeScript("document.getElementById('User').value= 'www.google.com'"); ● //To enter password JS.executeScript("document.getElementById('pass').value=' tester'");

How do you find a text in a webpage?

● //tagname[contains(text(),'text')] contains certain test ● //tagname[.='text'] contains exact text sometimes doesn't work Selenium

Sometimes sendKeys/path does not work. What would you do?

● Building a dynamic path for a file inside our project Path to the project location: ○ String projectDir= System.getProperty("user.dir") // project directory String file= "src/test/resources/test_data/myfile.txt"; Element.sendKeys(projectDir+file);

Why do we get NoSuchElementException?

● Check if locator is correct ● Check if timing is correct ● Check if element is hidden inside an iframe

File download and upload:

● Download ○ Selenium itself cannot verify file downloads, can click on download link but can't go outside the browser and open the downloaded file ○ Other tools need to be used for that Robot and AutoIT ● Upload ○ Selenium handles the upload, but does it differently compared to actual user ○ Steps ■ Find the element that triggers the upload window ■ Find the path of the file you want to upload ● Store into a String ○ Ex: String > "C:\\Users\\Andy\\Desktop\\folder.key"; ○ Then driver.findElement(upload button).sendkeys(file);

How do you handle dynamic elements?

● Find the static part of the id and write a locator(xpath or css) --> And then use Startswith, contains, EndsWith ● contains( ) --> //*[contains(@name=`btn`)] ● startwith( ) --> //label[startwith(@id, `message`)] ● text( ) --> //td[text() = `usedId`] ● or & and --> //input[@type = `submit` AND @name = `login`]

findElement vs findElements?

● FindElement > this method returns the first WebElement ! ○ gives Exception if the element not found ● FindElements > returns List <WebElement>; ○ does not give Exception if the element not found as a result list has null values

What is the syntax for switching frames?

● Frame is a html document inside another html document. ● Web driver handles one page/html document at a time. To control another frame, we always need to switch ● Driver.switchTo.frame(webelement) > find the iframe and pass as a param ● Driver.switchTo.frame(string) > find the id or name of the iframe and pass as a param ● Driver.switchTo.frame(int) > find the index and pass as a param

How to handle frames in Selenium?

● Frames used to embed a html page into another ● Steps ○ Locate the iframe ○ Switch to another iframe with driver.switchTo().frame(); .frame() --> takes string, Integer, webElement, name or id directly as parameter ■ driver.switchTo().frame(webElement); ■ driver.switchTo().frame(); ○ Now you are in the 2nd frame, if you want to find an element outside of the 2nd frame (that you're currently on) throws NosuchElementException ○ If you need to switch back to previous frame ■ driver.switchTo().parentFrame() --> Goes one level up ■ driver.switchTo().defaultcontent() --> Goes to the very top ○ Can switch using count ■ driver.switchTo(0) --> Counts anything that is not the default frame These methods might give you different results based on what browser you are using

What is the key class in Selenium?

● Gives us option for pressing keys from keyboard ● Key.ENTER ● MUST BE PASSED TO SendKeys() method ● Ex; .sendkeys("charger" + keys.ENTER)

ASSERT(hard assert) VS VERIFY(soft assert)?

● Hard assert throws an AssertException immediately when an assert statement fails, and the test suite continues with next @Test. If Assert steps fail, execution of test stops at that point! and will go to the next test if present! ○ (Example: just simple Assert.assertTrue(boolean);) ● Soft assert collects errors during @Test Soft Assert does not throw an exception when an assert fails and would continue with the next step after the assert statement. If Verify steps fails, it will report a fail but will continue execution! ○ Example: SoftAssert soft=new SoftAssert(); //for soft create object ○ soft.assertTrue(boolean); ○ soft.assertAll(); //put at the end it will report what is failing!

Which headless browser are you familiar with?

● Headless browser: browser that does not open, it runs as a background service / program. ● Example is htmlunitdriver from selenium ○ WebDriver = new htmlunitdriver() ○ Not very stable ● Phantonjsbrowser ○ More stable ○ browser = new phantomjsbrowser()

What exceptions do you know in Selenium?

● I often get NoSuchElementException ● StaleElementException ○ The element has been deleted entirely. ○ The element is no longer attached to the DOM. ○ How we handle StaleElementException; ■ Element is not attached to DOM à 'try catch block' within 'for loop' Or ■ 1. Refresh the page and try again for the same element. ■ 2. Wait for the element till it gets available ● TimeOutException

What are various ways of locating an element in Selenium?

● Id ● Name ● ClassName ● Xpath ● CSS ● LinkText ● PartialLinkText ● TagName

How do you handle js alerts?

● If the alert on the browser comes from JavaScript, we use the Alert class. ○ Alert alert = driver.switchTo.alert(); ■ alert.accept(); ■ alert.dismiss(); ■ alert.sendKeys(); ■ alert.getText();

How to work with dropdown without the select tag?

● If the dropdown list has no select tag, we cannot use the select class ● Treat the dropdown list and its options as separate elements, locate every element separately ● To select an option: ○ 1. Find and click on the list ○ 2. Find and click on the option

How to handle multiple frames?

● If there are 4 frames, you have to go through each from consecutively to reach a certain frame. Can't jump to the 3rd frame from 1st frame.

Implicit Wait vs Explicit Wait?

● Implicit wait is a wait which waits for a specified time while locating an element before throwing "NoSuchElementException". As by default selenium tries to find elements immediately without any wait. So, it is good to use implicit wait. This wait applied to all elements of the current driver instance. ● Explicit wait is a wait which is applied to a particular webelement until the ExpectedCondition specified is met. ● Implicit wait is simply; if condition is met before the timeout, it will continue to next step, if condition is not met within timeout throw "No Such Element" exception. ● Explicit wait sometimes we need to wait for a certain event/condition such as element is visible, clickable, enabled.... ● driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS); webDriverWait wait = new WebDriverWait (driver, 5); wait.until (ExpectedConditions.visibilityOf(element);

What is framework?

● In test automation, framework is the blueprint of test automation. ● It includes your folder structures, where to save you function library, test results, test data, resources. ● It is essential because when you are working on automation project everyone will have a guideline to follow and our script will be easier to maintain.

How to find all links in the page?

● List<WebElement> list = driver.findElements(By.tagName("a"));

Why can't I find the element?

● Locator changed ● There is an iframe ● Waiting time:: page is loading slowly or Element is dynamic:: locator ● Page is not fully loaded/opened ● Page changes and that element does not exist anymore

Page Factory class?

● Page Factory class comes with Selenium. ● And it is used whenever we create page object classes. ● Its purpose is to initialize webElements that were defined in the class.

What we don't do with selenium?

● Performance, load, stress testing (These tests are done by experts trained in these tools) ● Pure database testing (if we only test the DB itself), ● Unit tests..., look and feel based testing (color, shapes, etc.), ● static testing

What is the syntax for uploading a file?

● Public void fileUpload(String path){WebELement upload = driver.findELement; Upload.sendKeys(path)} ● We need to locate the upload button in html. ● The element will have tag input. ● Then we do sendKeys by passing the path to file which we want to upload

How check the selected value in dropdown?

● Select carsList = new Select(el) carList.getFirstSelectedOption() assertequals("some text",carList.getFirstSelectedOption().getText() )

How check the multiple selected values in dropdown?

● Select carsList = new Select(el) ● carList.getSelectedOptions(): //returns the the selected options a list (List<webelement>) ● for each : carList.getSelectedOptions()

How do you like Selenium version 3? Is Selenium 3 drastically different from Selenium 2?

● Selenium 3 has bug fixes from selenium 2 also it is more mobile automation focused. ● Mozilla have made changes to Firefox that mean that from Firefox 48 you must use their geckodriver to use that browser, regardless of whether you're using Selenium 2

How do you handle windows/ OS pop ups?

● Selenium doesn't support windows-based apps, it is an automation testing tool that supports only web application testing. ● We could handle windows-based popups in Selenium using some third-party tools such as AutoIT, Robot class

What are the advantages of Selenium?

● Selenium is open source and free to use without any licensing cost ● It supports multiple languages like Java, Ruby, Python, C#... ● It supports multi-browser testing ● It has a good amount of resources and helping community ● It supports many operating systems like Windows, Mac, Linux ... ● Interact with the web application

How to handle multiple windows/tabs?

● Selenium stays on one window ● If you open a window and then 5 tabs popped open, selenium is focused on the first window ● If you are on a new window and you tell selenium to print an element on the default window, it will still work even that user's focus is on the new window ● Must switch to new window ○ Use windowHandle() ○ Driver.getWindowHandle() ■ Everytime Selenium opens a browser, it's going to give a GUID for the page called Handles ■ Returns the handle/id of current page (as a string) ○ driver.switchTo().window(string handle) ○ driver.getWindowHandles() for multiple windows ■ Returns a Set of window handles ○ Switch using titles for(string handle: driver.getWindowHandles()){ driver.switchTo().Window(handle) if(driver.getTitle().equals(targetTitle){ break; } }

What are the disadvantages of Selenium?

● Selenium supports only web-based applications, does not support windows-based application ● No built-in reporting tool, it needs third party tools for report generation activity ● Cannot work with graphics, captchas, barcodes, shapes ● It does not support file upload facility ● Hard to master, requires developer level knowledge ● Hard to write good locators ● Hard to synchronize

What is Thread.sleep()?

● Slows down selenium to catch up ● Throws exception so must handle it or throw it

Absolute (/) and Relative (//) Xpath?

● Syntax --> //tagname[@attribute=`value`] ● Absolute xpath starts with a single slash ( / ), starting from root element and all the way to the element. ● Relative xpath starts with double slash ( // ), starting selection matching anywhere in the document.

What are some advantages of using the TestNG framework?

● TestNG is an open-source framework that helps create test cases in a systematic way. ● TestNG has more annotations which makes the test case creation easy. ● When using TestNG, priorities of the tests and the sequence of execution can be defined. ● Grouping is possible with TestNG. ● TestNG generates HTML reports (Selenium Webdriver cannot generate the test reports alone, TestNG helps SW to achieve this). ● Data parameterization is possible using TestNG.

What are some differences between TestNG and JUnit?

● TestNG supports group tests but it is not supported in JUnit. ● TestNG has a feature to configure dependency tests. Dependency test configuration for software web applications is not possible in JUnit. ● Test prioritization, Parallel testing is possible in TestNG. It is not supported by JUnit.

What kind of testing frameworks are you familiar with?

● There are mainly 4 type of frameworks created by Selenium WebDriver to automate test cases: ○ Data Driven Framework ■ It is one of the most popular automation frameworks in the market ■ All of our test data is generated from some external files; ● Excel ● or scenario outline in feature file/ ● or TestNG Data Provider ○ Keyword Driven Framework ■ Keyword driven testing is a scripting technique that uses data files to contain the keywords related to the application being tested. ■ Keywords are written in some external files like excel file and Java code will call this file and execute test cases. ○ Hybrid Driven Framework ■ A combination of the DDF and KDF is commonly said to be HDF. ■ Both the test data and test action are kept in external files. ○ Behaviour Driven Framework (BDD) → is the framework I'm using. It uses cucumber feature files, step definitions, runner class and page object classes.

How can we move to the nth child element using xpath?

● There are two ways: ○ using square brackets with index position ■ For ex: div[2] will find the second div element ○ using position ( ) method ■ For ex: div[position()=2] will find the second div element

How do you test dynamic web pages?

● There is no one size fits all solution to this problem. We have to understand the application very well ○ Use explicit waits where necessary. ○ Use custom xpaths and css locators ■ Xpath: contains, starts with, ends with, contains text. ■ By finding the element in relation to another stable element using parent, child, sibling relationships

How to check if an element is present/visible/enable/ and to check text present?

● To check Element Present: if(driver.findElements(By.xpath("value")).size() != 0){ System.out.println("Element is Present"); }else{ System.out.println("Element is Absent");} Or: if(driver.findElement(By.xpath("value"))!= null){ System.out.println("Element is Present"); }else{ System.out.println("Element is Absent"); } ● To check Visible: if(driver.findElement(By.cssSelector("a > font")).isDisplayed()){ System.out.println("Element is Visible"); }else{ System.out.println("Element is InVisible"); } ● To check Enable: if(driver.findElement(By.cssSelector("a > font")).isEnabled()){ System.out.println("Element is Enable"); }else{ System.out.println("Element is Disabled"); } ● To check text present: if(driver.getPageSource().contains("Text to check")){ System.out.println("Text is present"); }else{ System.out.println("Text is absent"); }

What is the syntax for switching windows?

● To handle separate tabs/windows we have to switch to that tab ● Web driver handles one page/html document at a time. ● To control another tab, we always need to switch ● To be able switch we need to get the window handle first using ○ getWindowHandles() method driver.switchTo.window(String) // > window handle //for each loop : driverGetWIndowHandles: Driver.switchTo.window("handle") Ifdriver.getTitle==expectedtitle; Break;

16. How to press ENTER key on text box in Selenium WebDriver?

● To press Enter key using Selenium WebDriver, ● We need to use Selenium Enum keys with its constant Enter ● Driver.findElement(By.xpath("xpath")).sendKeys(Keys.ENTER);

How To resize browser Window Using Selenium WebDriver?

● To resize the browser window to particular dimensions, we use 'Dimension' class to resize the browser window. ● //Create object of Dimensions class Dimension d = new Dimension(480,620); ● //Resize the current window to the given dimension driver.manage().window().setSize(d);

What tools are you using to test UX and Restful webServices?

● UX à User Experience. First ensure UX is acceptable manually. ● After that since it is UI testing, I use Selenium WebDriver to automate it. ● RESTFul API Automation > RestAssured Library ● PostMan for manual testing of APIs

How do you test dynamic tables?

● Use custom xpaths and css locators ○ Xpath: contains, starts with, ends with, contains text. ○ By finding the element in relation to another stable element using parent, child, sibling relationships ● I have utility methods that work with tables. I have a method that takes a table webelement and returns all the column names. I have a method that takes a table, number and returns all the data in that row.

How can we move to parent element using xpath?

● Using (..) expression in xpath, we can move to parent element

How do you verify if text exists?

● VerifyTextPresent à returns TRUE if the specified text string was FOUND somewhere in the page; FALSE if otherwise. ● VerifyTextNotPresent à returns TRUE if the specified text string was NOT FOUND anywhere in the page; FALSE if it was found.

What are the limitations of Selenium?

● We cannot test desktop application ● We cannot test web services ● We have to use external libraries and tools for performing tasks like testing framework (TestNG, JUnit), reading from external files (Apache POI for excel) ● Automating Captcha is not possible using Selenium ● It does not support file upload facility

How to handle Web Tables/grid?

● We use xpath for tables: table/tbody/tr[1]/td[1] ● Table tag used for table data is arranged in a grid format ○ th tag for column name Example: <tr> <th>FirstName</th> column names on the very top row <th>Lastname</th> <th>Age</th> </tr> ○ </tr> tr tag used to indicate a row, applies to whole column td tag to indicate a column in a row Example: <tr> <td>Danny</td> actual_data_on_the_very_first_row <td>Smith</td> <td>29</td> </tr> ● Some tables have tbody Used to indicate the data of the table, usually does not include column names ( th )

How did you use overloaded Methods in Selenium?

● When asserting if two values are equal, I use > Assert.assertEquals(actual, Expected) from TestNG' ● You can put in the parameters String, Objects, int, boolean values

What is fluentWait?

● With Fluent wait you can set how frequently Selenium should check back if condition is not met. It is done with parameter PollingEvery. ● Subtype of explicit wait but you can override the conditions ● Wait<WebDriver>wait=newFluentWait<Webdriver>(driver).withTimout(5,timeUnit. seconds).pollingEvery(100,timeunit.milliseconds).ignoring(NoSuchElementExcep tion.class);

Difference between xpath and css selector?

● With xpath, we can search elements backward or forward, while css works only in forward direction ● Xpath can work with text, css cannot work ● Xpath has more combination and can search by index, css cannot search by index, but css is working faster than xpath

What is Xpath?

● Xpath is used to find the location of any element on a webpage using html structure. ● We could navigate through elements and attributes in an XML document to locate web Elements such as textbox, button, checkbox, Image ext... in webPage

Have you done any cross-browser testing?

● Yes, I've used cross browser testing using both chrome and firefox in TestNG. There are parameters that needs to be set in the XML file like: thread-count, parallel. ● Always mention that you have a control file for keywords like browser type, main url, username, password, environment.

Do you use JavaScriptExecutor?

● Yes, in particularly I use javascript click method and scrollintoview methods. ● We can send JS commands to the browser with using this class ○ JavaScriptExecutor jsExecutor=(JavaScriptExecutor)driver; executeScript(); performs the command Inside the parameter is where you put JS code ● You can also put 2 parameters is .executeScript("js code",element); ○ Used for scrolling (selenium is not good with scrolling, you can say a challenge is when I was working on terms and condition page, where you have to read the page before clicking on continue. ○ When I tried using selenium and actions class it didn't work, so I used javaexecutor ) and clicking an element;

Difference between close() and quit() command?

● driver.close() --> used to close the current browser ● driver.quit() --> used to close all the browser instances

What is the difference between driver.get() and driver.navigateto()?

● driver.get() --> To open an URL and it will wait till the whole page gets loaded ● driver.navigateto() --> To navigate to an URL and it will not wait till the whole page get loaded

How to maximize a web page?

● driver.manage().window().maximize();

How would you verify the position of the Web Element on the page?

● element.getLocation(); ● WebElement class has a get Location method with returns the top left corner of the element

What types of testing do you automate with Selenium?

● functional tests (positive/negative, UI) ● smoke tests ● regression tests ● integration tests ● end to end testing ● data driven

Difference between isDisplayed(), isEnabled(), and isSelected() methods in selenium WebDriver?

● isDisplayed() > verify the presence of a web element within the web page. If found > true, If not found > false ● isEnabled() > verify if the web element is enabled or disabled within the web page. ● isEnabled() > is primarily used with buttons ● isSelected() > verifies if the web element is selected or not ● isSelected() > used with radio buttons, dropdowns and checkboxes.

How do you handle browser pop ups?

● void dismiss() --> clicks on the "Cancel" button as soon as the pop-up window appears. ● void accept() --> clicks on the "Ok" button as soon as the pop-up window appears. ● String getText() --> returns the text displayed on the alert box. ● void sendKeys(String stringToSend) --> enters the specified string pattern into the alert box.

What is in the Selenium tool set?

● • Selenium IDE à implemented as a Chrome and Firefox extension, and allows you to record, edit, and debug tests. ● • Selenium RC à to write automated web application UI tests in any programming language ● • Selenium WebDriverà execute your tests against different browsers ● • Selenium GRID à run your tests on different machines against different browsers in parallel.


Conjuntos de estudio relacionados

Ch. 14; HR: Employment Discrimination

View Set

Cartas sobre la ley y la gracia: Romanos y Galatas

View Set

Microeconomics: Technology, Production, and Costs

View Set

financial accounting book part 1

View Set