Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Selenium scLocator for simple Checkbox

    Hi

    I am a Software Tester and test an application which is developed with smart Google GWT.
    I recorded the scLocator with Selenium IDE.
    And develop the testautomatisation with java. Execute the test auto with Internet Explorer 11.0.9.

    The Software Developers use:
    1) SmartClient_v91p_2014-06-26_Pro
    2) The smartgwtpro-4.1p
    3) GWT SDK 2.5.1

    It is not possible to get the state (true or false) from the Checkbox which was recorded with a Selenium scLocator.
    I try isSelected(), isChecked() and getAttribute("value"). None of those works.
    But in standard selenium with xpaht the method isSelected() works fine.

    But not for an element which was recorded with an scLocator.
    Code:
    // C H E C K B O X -> scLocator –JAVA-CODE <-
    // import org.openqa.selenium.By;
    By loc_CheckBoxSample = ByScLocator.scLocator( "//VLayout[ID=\"gridform_Example..._ID\"]/member[Class=DynamicForm||index=0||length=2||classIndex=0||classLength=1]/item[name=sample...YN||title=sample||value=true||index=1||Class=CheckboxItem]/textbox");
    
    // import org.openqa.selenium.WebElement;
    WebElement cParagraph = driver.findElement(loc_CheckBoxSample);
    // import net.thucydides.core.webelements.Checkbox;
    Checkbox cbEE = new Checkbox(cParagraph);
    
    Boolean question = cParagraph.isSelected();
    Boolean bQuestion = cbEE.isChecked();
    System.out.println("question is " + question + " q= " + bQuestion);  // -> both false
    cParagraph.click();  // -> Checkbox toggles to true
    question = cParagraph.isSelected();
    bQuestion = cbEE.isChecked();
    System.out.println("question is " + question + " q= " + bQuestion);  // -> still both false
    
    // next try 
    String str2 = cParagraph.getAttribute("value"); 
    // 'str2' is in all cases null ?? Expected: true or false
    What is the problem?

    #2
    You can use the verifyValue() method of SmartClientWebDriver as documented here http://www.smartclient.com/smartgwte...WebDriver.html to verify a true or false value for the checkbox.

    Comment


      #3
      thank you. it works (scLocator for Checkbox isSelected)

      Originally posted by Isomorphic View Post
      You can use the verifyValue() method of SmartClientWebDriver as documented here http://www.smartclient.com/smartgwte...WebDriver.html to verify a true or false value for the checkbox.
      THANK YOU. (it works)
      Code:
      // private static WebDriver driver; -> not_OK
      // private static SmartClientIEDriver driver; -> OK
      // driver = new SmartClientIEDriver();
      Boolean quest1 = driver.verifyValue(loc_sample_Checkbox, true);
      System.out.println("xxx= " + quest1); // output false
      cParagraph.click(); // Checkbox goes to Checked
      quest1 = driver.verifyValue(loc_sampel_Checkbox, true);
      System.out.println("yyy= " + quest1); // output true
      Last edited by kthevessen2; 24 Jul 2014, 23:32. Reason: to hide information from customer

      Comment

      Working...
      X