@@ -1898,23 +1898,21 @@ class WebDriver extends Helper {
18981898 * libraries](http://jster.net/category/windows-modals-popups).
18991899 */
19001900 async acceptPopup ( ) {
1901- return this . browser . getAlertText ( ) . then ( res => {
1902- if ( res !== null ) {
1903- return this . browser . acceptAlert ( )
1904- }
1905- } )
1901+ const text = await this . browser . getAlertText ( )
1902+ if ( text ) {
1903+ return await this . browser . acceptAlert ( )
1904+ }
19061905 }
19071906
19081907 /**
19091908 * Dismisses the active JavaScript popup, as created by `window.alert|window.confirm|window.prompt`.
19101909 *
19111910 */
19121911 async cancelPopup ( ) {
1913- return this . browser . getAlertText ( ) . then ( res => {
1914- if ( res !== null ) {
1915- return this . browser . dismissAlert ( )
1916- }
1917- } )
1912+ const text = await this . browser . getAlertText ( )
1913+ if ( text ) {
1914+ return await this . browser . dismissAlert ( )
1915+ }
19181916 }
19191917
19201918 /**
@@ -1924,7 +1922,7 @@ class WebDriver extends Helper {
19241922 * @param {string } text value to check.
19251923 */
19261924 async seeInPopup ( text ) {
1927- return this . browser . getAlertText ( ) . then ( res => {
1925+ return await this . browser . getAlertText ( ) . then ( res => {
19281926 if ( res === null ) {
19291927 throw new Error ( 'Popup is not opened' )
19301928 }
@@ -2521,7 +2519,7 @@ class WebDriver extends Helper {
25212519 let res = await this . _locate ( locator , true )
25222520 assertElementExists ( res , locator )
25232521 res = usingFirstElement ( res )
2524- return this . browser . switchFrame ( res )
2522+ return this . browser . switchFrame ( res . elementId )
25252523 }
25262524
25272525 /**
@@ -2821,7 +2819,7 @@ async function proceedSeeField(assertType, field, value) {
28212819 const fieldResults = toArray (
28222820 await forEachAsync ( fields , async el => {
28232821 const elementId = getElementId ( el )
2824- return this . browser . isW3C ? el . getValue ( ) : this . browser . getElementAttribute ( elementId , 'value' )
2822+ return this . browser . getElementAttribute ( elementId , 'value' )
28252823 } ) ,
28262824 )
28272825
@@ -2847,15 +2845,21 @@ async function proceedSeeField(assertType, field, value) {
28472845 const filterSelectedByValue = async ( elements , value ) => {
28482846 return filterAsync ( elements , async el => {
28492847 const elementId = getElementId ( el )
2850- const currentValue = this . browser . isW3C ? await el . getValue ( ) : await this . browser . getElementAttribute ( elementId , 'value' )
2848+ const currentValue = await this . browser . getElementAttribute ( elementId , 'value' )
28512849 const isSelected = await this . browser . isElementSelected ( elementId )
28522850 return currentValue === value && isSelected
28532851 } )
28542852 }
28552853
28562854 const tag = await elem . getTagName ( )
28572855 if ( tag === 'select' ) {
2858- const subOptions = await this . browser . findElementsFromElement ( elemId , 'css' , 'option' )
2856+ let subOptions
2857+
2858+ try {
2859+ subOptions = await this . browser . findElementsFromElement ( elemId , 'css' , 'option' )
2860+ } catch ( e ) {
2861+ subOptions = await this . browser . findElementsFromElement ( elemId , 'xpath' , 'option' )
2862+ }
28592863
28602864 if ( value === '' ) {
28612865 // Don't filter by value
0 commit comments