I am new to Selenium, could any one of you let me know how to print the value selected from \'selectByVisibleText\' in selenium?
I have run the test on Facebook login pa
Once you select the option through selectByVisibleText() method to print the value you need to invoke getFirstSelectedOption() method as follows:
Code Block:
Select month_dd = new Select(month_dropdown);
month_dd.selectByVisibleText("Dec");
WebElement myElem = month_dd.getFirstSelectedOption();
System.out.println(myElem.getText());
Console Output:
Dec
PASSED: selectDDvalues
===============================================
Default test
Tests run: 1, Failures: 0, Skips: 0
===============================================