How to Maximize a firefox browser window using selenium webdriver

How to Maximize a firefox browser window using selenium webdriver?

Maximizing Browser window using Selenium webdriver script

package selenium_examples;


import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Test {

public static void main(String[] args) {


WebDriver driver = new FirefoxDriver();
driver.get("http://google.com");
driver.manage().window().maximize();
                driver.close();
}

}

Above script maximizes browser window and closes the browser.

First Selenium Webdriver Script


Script 1-

package selenium_examples;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class example1 {

public static void main(String[] args)
   {

WebDriver driver = new FirefoxDriver();
driver.get("http://www.funandknowledge.blogspot.com");
System.out.println(driver.getTitle());
System.out.println(driver.getCurrentUrl());
driver.close();
}

    }


Output will be :-

QTP Scripts
http://www.funandknowledge.blogspot.in/


Webdriver methods used in above script:

driver.get - Takes you to the Website www.funandknowledge.blogspot.com
driver.getTitle - Returns The title of the current page
driver.getCurrentUrl - Returns The URL of the page currently loaded in the browser
driver.close - Closes the current window

Other webdriver methods mostly used:

driver.getPageSource - Returns the page source of the current page
driver.quit - quits driver and closes every associated window


Script 2-

package selenium_examples;


import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Sample {

public static void main(String[] args)
   {

WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
driver.findElement(By.id("gbqfq")).sendKeys("site:funandknowledge.blogspot.com");
driver.findElement(By.id("gbqfb")).click();
}

    }

How to get list of Mail Subject of all unread emails in Outlook Inbox using QTP.



Qtp Script to get list of all unread emails in Outlook Inbox with Mail Subject

Set a = CreateObject("Outlook.Application")
Set b = a.GetNameSpace("MAPI")
Set c = b.GetDefaultFolder(6)
for i=1 to c.items.count
if c.items(i).unread then
List = List & c.items(i).Subject & vbCrLf
end if
next

How to get list of Senders Email Ids/Email Address of all unread emails in Outlook Inbox using QTP.



Qtp Script to get list of Senders Email Ids/Email Address of all unread emails in Outlook Inbox.

Set a = CreateObject("Outlook.Application")
Set b = a.GetNameSpace("MAPI")
Set c = b.GetDefaultFolder(6)
for i=1 to c.items.count
if c.items(i).unread then
List = List & c.items(i).SenderEmailAddress & vbCrLf
end if
next


Related Posts Plugin for WordPress, Blogger...

Fun and Knowledge

↑