Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.List;
- import java.util.concurrent.TimeUnit;
- import org.openqa.selenium.By;
- import org.openqa.selenium.Point;
- import org.openqa.selenium.WebDriver;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.firefox.FirefoxDriver;
- import org.openqa.selenium.firefox.FirefoxProfile;
- import org.openqa.selenium.firefox.internal.ProfilesIni;
- import org.openqa.selenium.interactions.Action;
- import org.openqa.selenium.interactions.Actions;
- public class TestjQuerySlider {
- public static void main(String[] args) throws InterruptedException {
- ProfilesIni allProfiles = new ProfilesIni();
- FirefoxProfile myProfile = allProfiles.getProfile("MyTestProfile");
- myProfile.setPreference("capability.policy.default.Window.frameElement.get","allAccess");
- WebDriver myTestDriver = new FirefoxDriver(myProfile);
- myTestDriver.manage().window().maximize();
- myTestDriver.manage().timeouts().implicitlyWait(1L,TimeUnit.SECONDS);
- myTestDriver.get("http://tinyurl.com/pvpk7o");
- Thread.sleep(5000L);
- try {
- List<WebElement> AlliFrameID = myTestDriver.findElements(By.tagName("iframe"));
- System.out.println(AlliFrameID.size());
- for(int i=0;i<=AlliFrameID.size();i++){
- System.out.println(AlliFrameID.get(i).getAttribute("class"));
- }
- } catch (Exception e) {
- myTestDriver.switchTo().frame(myTestDriver.findElement(By.className("demo-frame")));
- Point MyPoint= myTestDriver.findElement(By.xpath("//*[@id='slider']/a")).getLocation();
- WebElement someElement = myTestDriver.findElement(By.xpath("//*[@id='slider']/a"));
- System.out.println(MyPoint.x+"--------"+MyPoint.y);
- Actions builder = new Actions(myTestDriver);
- Action dragAndDrop = builder.clickAndHold(someElement).moveByOffset(100,5).release().build();
- dragAndDrop.perform();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement