Selenium Interview Questions and Answers for Experienced – Part 5
51) the Best Way To click on a hyperlink utilizing link-text?
driver.findElement(By.linkText(“Google”)).click();
The order discovers the component using hyperlink text and after that click on that component and so an individual might be redirected to the accompanying site.
All these hyperlink also can be obtained through the use of the next command.
driver.findElement(By.partialLinkText(“Goo”)).click();
The preceding control locate the component predicated on the sequence of the hyperlink supplied in the parenthesis and so partialLinkText() discovers the net component with the given sub-string and then clicks on it.
52) how to deal with body in WebDriver?
An in line body phrase as I-frame can be used to add yet another doc with-in the present HTML document or just a web site in to a website by empowering nesting.
Choose I frame by id
driver.switchTo().frame(“ID of the frame“);
Finding I-frame using tagName
driver.switchTo().frame(driver.findElements(By.tagName(“iframe”).get(0));
Finding I-frame utilizing index
frame(catalog)
driver.switchTo().frame(0);
————
Framework(Name of Body)
driver.switchTo().framework(“name of the frame”);
Framework(WebElement part)
Choose Parent Window
driver.switchTo().defaultContent();
53) When could we utilize findElement() and findElements()?
findElement(): findElement() can be used to locate the first take into account the present web site fitting to the given locator worth. Choose a observe that simply first matching component might be brought.
Format:
WebElement part = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));
findElements(): findElements() can be used to locate all the components in the present web site fitting to the given locator worth. Choose a notice that all the fitting components might be brought and saved in the listing of WebElements.
Checklist elementList = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));
54) The best way to deal with several windows in selenium webdriver?
We may possibly utilise web motorist’s windows coach to discover each window pane and use shift program to choose the window-pane for assessment.
55) Tips on how to browse with browser buttons in selenium webdriver?
We might use web driver’s back or forward way of version browser’s redirecting alternative attributes.
56) Which may function as the locators used by understanding the things in selenium webdriver?
In webdriver, we may possibly use part I d, name, cascading Style-Sheets, xpath, url text, in complete hyper-link text and Dominic to locate parts.
57) The greatest method to use the evaluations in ie utilizing selenium webdriver?
When generate a webdriver in the sign, we may possibly select InternetExplorerDriver to use I-D. If all of us want to using the many current and best choices that include the WebDriver “InternetExplorerDriver”, we should download Ie Host.
58) The greatest method to run the evaluations in Safari using selenium?In the established up procedure, we select FirefoxDriver for the webDriver.
59) The greatest method to use the evaluations in yahoo-opera using selenium webdriver?
Sometimes, webdriver can not begin chrome immediately, So (1) we may possibly use Desired Abilities of WebDriver, establish safari browser software course in the sign ; (2) we need to have chromedriver.exe document in the application path. As an alternative, we might byhand start chrome motorist support, and located the assessment in safari.
60) The greatest method to execute the evaluations without any browser or with HTML device motorist in selenium webdriver?
WebDriver driver = new HtmlUnitDriver();
61) The best way to use Selenium S/W S/W 1.0 assessments in webdriver?
We might use WebDriverBackedSelenium to execute Selenium S/W S/W 1.0 assessments in webdriver.
WebDriver driver = new FirefoxDriver();
Selenium s/w s/w selenium s/w s/w = new WebDriverBackedSelenium(driver, “http://www.yoursite.com”);
driver.findElement(By.linkText(“Google”)).click();
The order discovers the component using hyperlink text and after that click on that component and so an individual might be redirected to the accompanying site.
All these hyperlink also can be obtained through the use of the next command.
driver.findElement(By.partialLinkText(“Goo”)).click();
The preceding control locate the component predicated on the sequence of the hyperlink supplied in the parenthesis and so partialLinkText() discovers the net component with the given sub-string and then clicks on it.
52) how to deal with body in WebDriver?
An in line body phrase as I-frame can be used to add yet another doc with-in the present HTML document or just a web site in to a website by empowering nesting.
Choose I frame by id
driver.switchTo().frame(“ID of the frame“);
Finding I-frame using tagName
driver.switchTo().frame(driver.findElements(By.tagName(“iframe”).get(0));
Finding I-frame utilizing index
frame(catalog)
driver.switchTo().frame(0);
————
Framework(Name of Body)
driver.switchTo().framework(“name of the frame”);
Framework(WebElement part)
Choose Parent Window
driver.switchTo().defaultContent();
53) When could we utilize findElement() and findElements()?
findElement(): findElement() can be used to locate the first take into account the present web site fitting to the given locator worth. Choose a observe that simply first matching component might be brought.
Format:
WebElement part = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));
findElements(): findElements() can be used to locate all the components in the present web site fitting to the given locator worth. Choose a notice that all the fitting components might be brought and saved in the listing of WebElements.
Checklist elementList = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));
54) The best way to deal with several windows in selenium webdriver?
We may possibly utilise web motorist’s windows coach to discover each window pane and use shift program to choose the window-pane for assessment.
55) Tips on how to browse with browser buttons in selenium webdriver?
We might use web driver’s back or forward way of version browser’s redirecting alternative attributes.
56) Which may function as the locators used by understanding the things in selenium webdriver?
In webdriver, we may possibly use part I d, name, cascading Style-Sheets, xpath, url text, in complete hyper-link text and Dominic to locate parts.
57) The greatest method to use the evaluations in ie utilizing selenium webdriver?
When generate a webdriver in the sign, we may possibly select InternetExplorerDriver to use I-D. If all of us want to using the many current and best choices that include the WebDriver “InternetExplorerDriver”, we should download Ie Host.
58) The greatest method to run the evaluations in Safari using selenium?In the established up procedure, we select FirefoxDriver for the webDriver.
59) The greatest method to use the evaluations in yahoo-opera using selenium webdriver?
Sometimes, webdriver can not begin chrome immediately, So (1) we may possibly use Desired Abilities of WebDriver, establish safari browser software course in the sign ; (2) we need to have chromedriver.exe document in the application path. As an alternative, we might byhand start chrome motorist support, and located the assessment in safari.
60) The greatest method to execute the evaluations without any browser or with HTML device motorist in selenium webdriver?
WebDriver driver = new HtmlUnitDriver();
61) The best way to use Selenium S/W S/W 1.0 assessments in webdriver?
We might use WebDriverBackedSelenium to execute Selenium S/W S/W 1.0 assessments in webdriver.
WebDriver driver = new FirefoxDriver();
Selenium s/w s/w selenium s/w s/w = new WebDriverBackedSelenium(driver, “http://www.yoursite.com”);