Part 5
21 : How does selenium RC software testing tool drive the browser?
Answer :
When browser loaded In Selenium RC, It ‘injected’ javascript functions into the browser as well as and then It Is using javascript to drive the browser for software application nether test.
When browser loaded In Selenium RC, It ‘injected’ javascript functions into the browser as well as and then It Is using javascript to drive the browser for software application nether test.
22 : How does the selenium WebDriver drive the browser?
Answer : Selenium webdriver software testing tool plant similar existent user Interacting amongst software spider web page as well as Its elements. It Is using each browser's native back upward to brand conduct calls amongst browser for your software application nether test. There Is non whatever Intermediate thing In selenium webdriver to Interact amongst spider web browsers.
VIEW MORE TUTORIALS on selenium WebDriver.
VIEW MORE TUTORIALS on selenium WebDriver.
23 : Do you need Selenium Server to run your tests In selenium WebDriver?
Answer : It depends. If you lot are using alone selenium webdriver API to run your tests as well as you lot are running your all your tests on same machine as well as then you lot create non take away selenium server because In this case, webdriver tin straight Interact amongst browser using browser's native support.
You take away selenium server amongst webdriver when you lot convey to perform bellow given operations amongst selenium webdriver.
You take away selenium server amongst webdriver when you lot convey to perform bellow given operations amongst selenium webdriver.
- When you lot are using remote or virtual machine to run webdriver tests for software spider web application as well as that machine have specific browser version that is non on your electrical flow machine.
- When you lot are using selenium-grid to distribute your webdriver's exam execution on dissimilar remote or virtual machines.
24 : Bellow given syntax volition piece of occupation to navigate to specified URL In WebDriver? Why?
You take away to render http:// protocol amongst URL In driver.get method equally bellow.
driver.get("www.google.com");
Answer : No. It volition non piece of occupation as well as exhibit you lot an exception similar : "Exception inward thread "main" org.openqa.selenium.WebDriverException: f.QueryInterface is non a function" when you lot run your test.You take away to render http:// protocol amongst URL In driver.get method equally bellow.
driver.get("http://www.google.com");
Now It volition work. 25 : Tell me a argue behind bellow given WebDriver exception and how volition you lot resolve It?
"Exception inward thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element" Answer : You volition larn this exception when WebDriver Is non able to locate chemical component on the page of software spider web application using whatever locator you lot convey used In your test. To resolved this Issue, I volition depository fiscal establishment jibe bellow given things.
- First of all I volition depository fiscal establishment jibe that I convey placed Implicit await code In my exam or not. If you lot convey non placed Implicit timeout In your exam as well as whatever chemical component Is taking to a greater extent than or less fourth dimension to seem on page as well as then you lot tin larn this exception. So I volition add together bellow given business at inaugural of all of my exam example code to await for fifteen seconds for chemical component to last acquaint on page. In 70% cases, this footstep volition resolved Issue. View Practical Example Of Implicit Wait.
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
- Another argue behind this Issue Is element's ID Is generated dynamically every fourth dimension when reloading the page. If I convey used element's ID equally an chemical component locator or used It In xpath to locate the chemical component as well as then I take away to verify that ID of chemical component remains same every fourth dimension or It Is changing? If It Is changing every fourth dimension as well as then I convey to usage choice chemical component locating method. In 20% cases, This footstep volition resolve your Issue.
- If Implicit await Is already added as well as chemical component locator Is fine as well as then you lot take away to verify that how much fourth dimension It(element) Is taking to seem on page. If It Is taking to a greater extent than than fifteen seconds as well as then you lot convey to set explicit await status amongst xx or to a greater extent than seconds await menstruum equally bellow. In v to 10% cases, This footstep volition resolve your Issue. View Example.
WebDriverWait await = novel WebDriverWait(driver, 25); wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("#submitButton")));