1. Code for select the Bootstrap DropDown ? package Selenium_with_java;import java.awt.List;import org.openqa.selenium.By;import org.openqa.selenium.WebDriver;import org.openqa.selenium.WebElement;im…

1. Code for select the Bootstrap DropDown ?

package Selenium_with_java;import java.awt.List;import org.openqa.selenium.By;import org.openqa.selenium.WebDriver;import org.openqa.selenium.WebElement;import org.openqa.selenium.chrome.ChromeDriver;import org.openqa.selenium.support.ui.Select;
import String.string;

public class Cureency_Direct

{

public static void main(String[] args) throws InterruptedException

{

System.setProperty("webdriver.chrome.driver", "E:/Sourabh_Sir_Data/chromedriver.exe");

WebDriver driver = new ChromeDriver(); driver.get("https://www.currenciesdirect.com/en");     driver.findElement(By.id("select2-HomeCurrencyFrom-container")).click();       

java.util.List<WebElement>elementcount = driver.findElements(By.xpath(".//*[@class='currency-code']"));     System.out.println(elementcount.size());   

for (int i = 0; i < elementcount.size(); i++)

 {

WebElement element = elementcount.get(i);

String innerhtml = element.getAttribute("innerHTML");

System.out.println("Value of the Dropdown button : " + innerhtml);

   } 

driver.findElement(By.id("select2-HomeCurrencyTo-container")).click();   

java.util.List<WebElement>element1count = driver.findElements(By.xpath(".//*[@class='select2-results__option']")); System.out.println(element1count.size());   

for (int i = 0; i < element1count.size(); i++) 

{

WebElement element = element1count.get(i); String innerhtml = element.getAttribute("innerHTML"); System.out.println("From this currency : " + innerhtml);

        }

     }
}

Views: 19

Comment

You need to be a member of Pune OpenCoffee Club to add comments!

Join Pune OpenCoffee Club

© 2018   Created by Santosh.   Powered by

Badges  |  Report an Issue  |  Terms of Service