driver.findElementByXPath("/html/body/div[5]/div[2]/div[2]/div/div[1]/div/div[2]/div/div[1]/form/div[3]/div[1]/div/div[2]/textarea").sendKeys("Which Automation Tool is best ?");
// driver.findElementByXPath("/html/body/div[3]/div[2]/div[2]/div/div[1]/div/div[2]/div/div[1]/form/div[3]/div[1]/div/div[2]/textarea").sendKeys("Which Automation Tool is best ?");
// driver.findElementByCssSelector("html body.fuelux div#list-questions div div.col-xs-9.well.well-lg.overflowscroll.min-container-all div#question_area.question-list.connected div.list-group.connected.ui-sortable.questionlist.welcome-question.question-container div#6d62f41d.questionContent.panel-body.pull-center.panel.panel-default div#informationQuestionTab.questionTab div.tab-content div#edit1.tab-pane.active form#welcomeQuestionForm div.col-xs-12.text-muted.text-muted-less-margin div.col-xs-7 div.form-group div.text-muted.text-muted-less-margin textarea#question-verbiage.form-control").sendKeys("Which automation tool is best");
Thread.sleep(2000);
driver.findElementByXPath("/html/body/div[5]/div[2]/div[2]/div/div[1]/div/div[2]/div/div[1]/form/div[3]/div[1]/div/div[6]/textarea").sendKeys("Selenium is the best Automation tools");
//driver.findElementByXPath("/html/body/div[3]/div[2]/div[2]/div/div[1]/div/div[2]/div/div[1]/form/div[3]/div[1]/div/div[6]/textarea").sendKeys("Selenium is the best Automation tools");
Thread.sleep(2000);
// driver.findElementByXPath("/html/body/div[3]/div[2]/div[2]/div/div[1]/div/div[2]/button[1]").isSelected();
//driver.findElement(By.name("Save")).sendKeys(Keys.ENTER);
driver.findElementByXPath("/html/body/div[5]/div[2]/div[2]/div/div[1]/div/div[2]/button[1]").sendKeys(Keys.ENTER);
//Multiple Choice
act.dragAndDrop(driver.findElementByXPath("/html/body/div[5]/div[2]/div[1]/div[2]/ul/li[4]/a/div"), driver.findElementByXPath("/html/body/div[5]/div[2]/div[2]/div/div[2]/div")).build().perform();
Thread.sleep(2000);
driver.findElementByXPath("/html/body/div[5]/div[2]/div[2]/div/div[2]/div/div/div[2]/div/div[1]/form/div[3]/div[1]/div[1]/div[2]/textarea").sendKeys("Which is the automation tool");
Thread.sleep(2000);
driver.findElementByXPath("/html/body/div[5]/div[2]/div[2]/div/div[2]/div/div/div[2]/div/div[1]/form/div[3]/div[1]/div[1]/div[6]/textarea").sendKeys("automation is the use to control the execution of tests and the comparison of actual outcomes with predicted outcomes.");
Thread.sleep(2000);
driver.findElementByXPath("/html/body/div[5]/div[2]/div[2]/div/div[2]/div/div/div[2]/div/div[1]/form/div[3]/div[2]/div/div[2]/div[1]/button[1]").click();
Thread.sleep(2000);
driver.findElementByXPath("/html/body/div[5]/div[2]/div[2]/div/div[2]/div/div/div[2]/div/div[1]/form/div[3]/div[2]/div/div[3]/div[1]/a/img").click();
Thread.sleep(2000);
driver.findElementByXPath("/html/body/div[5]/div[2]/div[2]/div/div[2]/div/div/div[2]/div/div[1]/form/div[3]/div[2]/div/div[3]/div[1]/div/div[2]/center/button").click();
Thread.sleep(2000);
driver.findElementByXPath("/html/body/div[6]/div/div/div[2]/form/div[1]/input[1]").click();
Thread.sleep(2000);
driver.findElementByXPath("/html/body/div[5]/div[2]/div[2]/div/div[2]/div/div/div[2]/div/div[1]/form/table/tbody/tr[1]/td[1]/input").sendKeys("Selenium");
driver.findElementByXPath("/html/body/div[5]/div[2]/div[2]/div/div[2]/div/div/div[2]/div/div[1]/form/table/tbody/tr[2]/td[1]/input").sendKeys("Java");
driver.findElementById("optionsText2").click();
driver.findElementByXPath("/html/body/div[5]/div[2]/div[2]/div/div[2]/div/div/div[2]/div/div[1]/form/table/tbody/tr[3]/td[1]/input").sendKeys("C");
StringSelection s1=new StringSelection("C:\\Users\\piyush\\Desktop\\SurveyGamez\\Eclipse\\Pics\\pics.jpg");
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s1,null);
Robot robot1 = new Robot();
Thread.sleep(1000);
robot1.keyPress(java.awt.event.KeyEvent.VK_ENTER);
robot1.keyRelease(java.awt.event.KeyEvent.VK_ENTER);
robot1.keyPress(java.awt.event.KeyEvent.VK_CONTROL);
robot1.keyPress(java.awt.event.KeyEvent.VK_V);
robot1.keyRelease(java.awt.event.KeyEvent.VK_CONTROL);
robot1.keyRelease(java.awt.event.KeyEvent.VK_V);
Thread.sleep(1000);
robot1.keyPress(java.awt.event.KeyEvent.VK_ENTER);
robot1.keyRelease(java.awt.event.KeyEvent.VK_ENTER);
Thread.sleep(2000);
driver.findElementByXPath("/html/body/div[6]/div/div/div[2]/form/input").click();
}
package SurveyGamez;
import java.awt.AWTException; import java.awt.Desktop.Action; import java.awt.datatransfer.StringSelection; import java.awt.Robot; import java.awt.Toolkit; import java.awt.Event; import java.util.concurrent.TimeUnit;
import org.junit.BeforeClass; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.interactions.Actions; import org.testng.annotations.BeforeMethod;
import com.thoughtworks.selenium.webdriven.commands.KeyEvent;
import org.testng.annotations.*;
public class Surveygamezz1 {
// Upload image
StringSelection s=new StringSelection("C:\Users\piyush\Desktop\SurveyGamez\Eclipse\Pics\pics.jpg"); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s,null);
driver.findElementByXPath("/html/body/div[5]/div[2]/div[2]/div/div[1]/div/div[2]/div/div[1]/form/div[3]/div[1]/div/div[2]/textarea").sendKeys("Which Automation Tool is best ?"); // driver.findElementByXPath("/html/body/div[3]/div[2]/div[2]/div/div[1]/div/div[2]/div/div[1]/form/div[3]/div[1]/div/div[2]/textarea").sendKeys("Which Automation Tool is best ?"); // driver.findElementByCssSelector("html body.fuelux div#list-questions div div.col-xs-9.well.well-lg.overflowscroll.min-container-all div#question_area.question-list.connected div.list-group.connected.ui-sortable.questionlist.welcome-question.question-container div#6d62f41d.questionContent.panel-body.pull-center.panel.panel-default div#informationQuestionTab.questionTab div.tab-content div#edit1.tab-pane.active form#welcomeQuestionForm div.col-xs-12.text-muted.text-muted-less-margin div.col-xs-7 div.form-group div.text-muted.text-muted-less-margin textarea#question-verbiage.form-control").sendKeys("Which automation tool is best"); Thread.sleep(2000); driver.findElementByXPath("/html/body/div[5]/div[2]/div[2]/div/div[1]/div/div[2]/div/div[1]/form/div[3]/div[1]/div/div[6]/textarea").sendKeys("Selenium is the best Automation tools"); //driver.findElementByXPath("/html/body/div[3]/div[2]/div[2]/div/div[1]/div/div[2]/div/div[1]/form/div[3]/div[1]/div/div[6]/textarea").sendKeys("Selenium is the best Automation tools"); Thread.sleep(2000); // driver.findElementByXPath("/html/body/div[3]/div[2]/div[2]/div/div[1]/div/div[2]/button[1]").isSelected(); //driver.findElement(By.name("Save")).sendKeys(Keys.ENTER); driver.findElementByXPath("/html/body/div[5]/div[2]/div[2]/div/div[1]/div/div[2]/button[1]").sendKeys(Keys.ENTER);
}