0

I succeed to automate this radio button (HTML):

<input type="radio" name="CurrencyCode" id="CurrencyCode_USD" value="02" onclick="switchCurrencyCodeProcess(this.value);updateMinimunLabel(this.value);"> USD
<input type="radio" name="CurrencyCode" id="CurrencyCode_IDR" value="88" onclick="switchCurrencyCodeProcess(this.value);updateMinimunLabel(this.value)" checked="checked"> IDR

Here's how I get my webElement (locator) Proposal.java file:

@FindBy(locator = "header.tabInformation.radioCurrency")
QAFWebElement radioCurrency; 

My function to get a value from radio button using Selenium (Proposal.java):

import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
import org.testng.Assert;
   
import com.manulife.ap.GenObjGui;
import com.qmetry.qaf.automation.core.QAFTestBase;
import com.qmetry.qaf.automation.ui.WebDriverBaseTestPage;
import com.qmetry.qaf.automation.ui.annotations.FindBy;

public class Proposal extends WebDriverBaseTestPage<WebDriverTestPage> {
   @FindBy(locator = "header.tabInformation.radioCurrency")
   QAFWebElement radioCurrency;
    
   public void SelectRadio(String valueCurrency) {
       for(int i=0; i<radioCurrency.size();i++) {
           WebElement localRadio =radioCurrency.get(i);
        
           String value=localRadio.getAttribute("value");
        
           if(value.equalsIgnoreCase(valueCurrency)) {
               localRadio.click();
           }
       }
   }
}

Anyone can help me how to create a function for the radio using this document: Enum UiElement.Type (QMETRY)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.