Это мой код
не может относиться к выпадающего списка и даже не может получить URL-адресне может вызвать падение вниз и даже не может ссылаться на текущий URL
Код содержат открытие URL, а затем в меню нажмите и затем открывая выпадающий ни я не могу открыть выпадающий ни я могу открыть текущий URL, пожалуйста, предложите
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.gargoylesoftware.htmlunit.javascript.host.svg.SVGTextElement;
public class LoginTest {
private WebDriver driver;
private String baseUrl;
String[] arr=new String[50];
/*TO open URL*/
@BeforeMethod
public void setUp() throws Exception {
driver = new FirefoxDriver();
baseUrl = "http://52.74.254.186:8088/mdmapp/ShowLogin.action?popup=true";
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
//UserName & Password creation
/* for(int i=1;i<=50;i++){
if(i<=25){
arr[i-1]="opo."+i;
}else{
arr[i-1]="sooksham."+(i-25);
}
}*/
}
@Test (priority = 1)
public void testLoginMDM() throws Exception {
//captures the dynamic url like popup
/*for(int i=0;i<arr.length;i++)*/{
driver.get(baseUrl + "/mdmapp/ShowLogin.action?popup=true");
driver.findElement(By.id("loginId")).clear();
driver.findElement(By.id("loginId")).sendKeys("opo.1");
driver.findElement(By.id("loginPassword")).clear();
driver.findElement(By.id("loginPassword")).sendKeys("opo.1");
driver.findElement(By.id("login_")).click();
Thread.sleep(1000);
/*WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.linkText("Home")));*/
/*Open Data Cleansing and Migration > DeDuplication & Survivorship*/
Actions actions = new Actions(driver);
WebElement mainMenu = driver.findElement(By.xpath("//span[contains(@class,'menu-name')]"));
actions.moveToElement(mainMenu);
WebElement subMenu = driver.findElement(By.id("listpro_3"));
actions.moveToElement(subMenu);
actions.build().perform();
Thread.sleep(20);
WebElement subsubMenu = driver.findElement(By.xpath("//a[contains(text(),'DeDuplication & Survivorship')]"));
subsubMenu.click();
Select dropdown = new Select(driver.findElement(By.id("ruleId")));
dropdown.selectByVisibleText("titlecheck");
System.out.println("The Output of the IsSelected " +
driver.findElement(By.id("ruleId")).isSelected());
System.out.println("The Output of the IsEnabled " +
driver.findElement(By.id("ruleId")).isEnabled());
System.out.println("The Output of the IsDisplayed " +
driver.findElement(By.id("ruleId")).isDisplayed());
Select oSelection = new Select(driver.findElement(By.id("ruleId")));
oSelection.selectByVisibleText("titlecheck");
WebElement select = driver.findElement(By.name("ruleId"));
Select se=new Select(select);
se.selectByIndex(1046);
}
}
/*After method to close*/
@AfterMethod
public void closewindow()
{
driver.quit();
}
}