Toggle navigation
Home
(current)
Selenium Training
Course Details
Free Videos
Support Forum
QTP UFT Training
Course Details
Free Videos
Support Forum
Appium Training
Course Details
Free Videos
Support Forum
Contact Us
(current)
All Courses
(current)
Login
(current)
Avail Discount
Name
Email
Phone Number
Tools
Selenium
QTP/UFT
Appium
Enroll Now
Home
Forum
Selenium Forum
Am trying to msg a frnd via fb messenger...Am facing issues
Am trying to msg a frnd via fb messenger...Am facing issues
M
Posted on 26/03/2016
Following is my code sir//
Pls enter respective email id /pwd & respective frnd name:
[b:lmc92set]Issue :[/b:lmc92set] [b:lmc92set]Am unable to type text in fb text box......[/b:lmc92set]
package p1;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
public class Names {
public static void main(String[] args) {
// TODO Auto-generated method stub
WebDriver w= new FirefoxDriver();
w.get("https://www.facebook.com/");
w.manage().timeouts().pageLoadTimeout(30, TimeUnit.MILLISECONDS);
w.findElement(By.name("email")).sendKeys("sonso@gmail.com");//-----------ur email
w.findElement(By.name("pass")).sendKeys("urpwd");//-----------ur pwd
w.findElement(By.id("loginbutton")).sendKeys(Keys.ENTER);
//----Login done---------------------------------
w.manage().timeouts().pageLoadTimeout(500, TimeUnit.MILLISECONDS);
/*int size = w.findElements(By.tagName("iframe")).size();
try{
w.findElement(By.xpath("html/body/div[1]/div[1]/div/div[1]/div/div/div/div[2]/div[2]/div[3]/div/a/div")).click();
}
catch(Exception e)
{
//e.printStackTrace();
}
w.manage().timeouts().pageLoadTimeout(600, TimeUnit.MILLISECONDS);
//w.findElement(By.xpath("//a[@class='jewelButton']/div")).click();
try{
w.findElement(By.linkText("Messages")).click();
}
catch(Exception e)
{
//e.printStackTrace();
}
w.manage().timeouts().pageLoadTimeout(600, TimeUnit.MILLISECONDS);
w.manage().window().maximize();
w.switchTo().frame(0);
w.switchTo().defaultContent();
w.manage().timeouts().pageLoadTimeout(600, TimeUnit.MILLISECONDS);
WebElement ToText=w.findElement(By.xpath("//div[@class='squareProfile']/div[2]/span/label/input"));
ToText.click();
ToText.sendKeys("Kiran Srivatsa");
w.findElement(By.xpath("//div[@class='squareProfile']/div[2]/span/label/input")).sendKeys(Keys.ENTER);
w.manage().timeouts().pageLoadTimeout(600, TimeUnit.MILLISECONDS);
//-----------chat wid a frnd
HashSet <String>IDs=new HashSet<String>();
IDs=(HashSet<String>) w.getWindowHandles();
System.out.println("size of haeshset"+IDs.size());
//w.switchTo().frame(0);
//w.findElement(By.xpath("//div[@title='Type a message...']/div/div/div")).sendKeys("hiii");
System.out.println(w.findElement(By.xpath("//div[@class='fbNubFlyoutFooter']/div/div[1]")).getText());
WebElement ChatFrnd=w.findElement(By.xpath("//div[@class='fbNubFlyoutFooter']/div/div[1]"));
//ChatFrnd.click();
ChatFrnd.sendKeys("kkkkkk");
ChatFrnd.sendKeys(Keys.ENTER);
}
M
Replied on 27/03/2016
Works..issue resolved...