Latest Interview Questions On Selenium Advanced Usage

Part 23

108 : I wants to pass parameter In software test case through testng.xml file. How can I do It?

Answer : You can use <parameter> node under <test> node In testng.xml file with parameter name and value. Then you can use @Parameters annotation with parameter name In your test case of software web application. VIEW USAGE OF @PARAMETER ANNOTATION.

109 : My page contains file upload field but I am not able to upload file using selenium webdriver software testing tool. Is there any other way using which I can upload file In selenium test?

Answer : If you are not able to upload file using selenium webdriver then you can create file upload script In AutoIT and then you can use It In selenium webdriver software test. You can refer bellow given articles to learn more about It.
110 : I wants to set size and position of my browser window. Do you know how to do it in selenium webdriver?

Answer : We can use setSize function to set size of window and setPosition function to set position of browser window. VIEW EXAMPLE.

111 : Is there any way to get size and position of browser window in selenium webdriver?

Answer : Yes.. We can get it using webdriver functions getSize and getPosition. VIEW MORE

112 : I wants to scroll my software web application page by 300 pixel. Tell me how can i do it?

Answer : We can use javascript executor with window.scrollBy(x,y) to scroll page in x or y directions. VIEW MORE DETAIL

4 comments:

  1. I have practiced using Selenium on different examples by myself.
    I am trying to automate testing of a webpage:
    It's a button "New" in Google Drive with expanding elements. I have used XPath locator (driver.FindElement(By.XPath("")) to find button "New", but I don't know how to get access to the expanded elements and click on them by using C# and webdriver (for example "Folder" element).

    ReplyDelete
    Replies
    1. You can found out locators using Selenium IDE and Firebug.
      "New" button has locator //div[@id='drive_main_page']/div/div[2]/div[2]/div/div/div/div/div/div/div/div/div/div/div/div
      "Folder" button has locator //div[@id=':56']
      Nevertheless, playback doesn't work for me, can't understand why drop down list doesn't appear after clicking "New" button. Hope i helped.

      Delete
    2. This comment has been removed by the author.

      Delete
  2. For uploading fule autoit is not necessary you can upload the file using direct send keys method using the xpath where developer used upload or file upload in their code

    ReplyDelete