How to handle WebUI.click() and WebUI.setText() built in keywords using “XPATH”












1















I am unable to click on an object/ unable to set a text in login box using xpath



WebUI.setText(driver.findElement(By.xpath("//*[@id="edit-name"]")), username)
WebUI.setText(driver.findElement(By.xpath("//*[@id="edit-pass"]")), password)
WebUI.click(driver.findElement(By.xpath("//*[@id="user-login"]/div/div/button")))


Text should be entered in to the login boxes
click on Go button!










share|improve this question





























    1















    I am unable to click on an object/ unable to set a text in login box using xpath



    WebUI.setText(driver.findElement(By.xpath("//*[@id="edit-name"]")), username)
    WebUI.setText(driver.findElement(By.xpath("//*[@id="edit-pass"]")), password)
    WebUI.click(driver.findElement(By.xpath("//*[@id="user-login"]/div/div/button")))


    Text should be entered in to the login boxes
    click on Go button!










    share|improve this question



























      1












      1








      1








      I am unable to click on an object/ unable to set a text in login box using xpath



      WebUI.setText(driver.findElement(By.xpath("//*[@id="edit-name"]")), username)
      WebUI.setText(driver.findElement(By.xpath("//*[@id="edit-pass"]")), password)
      WebUI.click(driver.findElement(By.xpath("//*[@id="user-login"]/div/div/button")))


      Text should be entered in to the login boxes
      click on Go button!










      share|improve this question
















      I am unable to click on an object/ unable to set a text in login box using xpath



      WebUI.setText(driver.findElement(By.xpath("//*[@id="edit-name"]")), username)
      WebUI.setText(driver.findElement(By.xpath("//*[@id="edit-pass"]")), password)
      WebUI.click(driver.findElement(By.xpath("//*[@id="user-login"]/div/div/button")))


      Text should be entered in to the login boxes
      click on Go button!







      selenium-webdriver automated-tests katalon-studio






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 4 at 11:37









      Mate Mrše

      1,8922627




      1,8922627










      asked Jan 2 at 6:08









      NagendraNagendra

      61




      61
























          3 Answers
          3






          active

          oldest

          votes


















          1














          WebUI object works with TestObject, not the WebElement of selenium. You could either use manual mode or scripting mode to create the test script.






          share|improve this answer
























          • What is the difference/connection between TestObject and WebElement?

            – Mate Mrše
            Jan 3 at 13:50











          • TestObject is the object in Katalon and we can use it like findTestObject. WebElement is from Selenium. We need to use selenium command for it.

            – Tony Bui
            Jan 3 at 13:52











          • So, it is just a formal difference - Katalon uses one, and Selenium the other? But, it is the same thing, basically.

            – Mate Mrše
            Jan 3 at 13:54



















          0














          Please try without using the object WebUI.
          If you can share the entire code along with the error message in the console it would be great.






          share|improve this answer































            0














            First, you define test objects like this:



            TestObject editName = new TestObject().addProperty('xpath', ConditionType.EQUALS, '//[@id="edit-name"]')
            TestObject editPass = new TestObject().addProperty('xpath', ConditionType.EQUALS, '//[@id="edit-pass"]')
            TestObject userLogin = new TestObject().addProperty('xpath', ConditionType.EQUALS, '//*[@id="user-login"]/div/div/button')


            And then use them in your script



            WebUI.setText(editName, username) 
            WebUI.setText(editPass, password)
            WebUI.click(userLogin)


            Note: I guess username and password used here are variable names, otherwise use 'username' and 'password'.



            Note 2: you will need the following imports at the top of the script:



            import com.kms.katalon.core.testobject.ConditionType
            import com.kms.katalon.core.testobject.TestObject as TestObject





            share|improve this answer
























            • Hi It's working now Thanks,

              – Nagendra
              Jan 7 at 6:22













            • If you found it useful, please accept the answer (click the checkmark next to the answer).

              – Mate Mrše
              Jan 7 at 7:09











            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54001962%2fhow-to-handle-webui-click-and-webui-settext-built-in-keywords-using-xpath%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            WebUI object works with TestObject, not the WebElement of selenium. You could either use manual mode or scripting mode to create the test script.






            share|improve this answer
























            • What is the difference/connection between TestObject and WebElement?

              – Mate Mrše
              Jan 3 at 13:50











            • TestObject is the object in Katalon and we can use it like findTestObject. WebElement is from Selenium. We need to use selenium command for it.

              – Tony Bui
              Jan 3 at 13:52











            • So, it is just a formal difference - Katalon uses one, and Selenium the other? But, it is the same thing, basically.

              – Mate Mrše
              Jan 3 at 13:54
















            1














            WebUI object works with TestObject, not the WebElement of selenium. You could either use manual mode or scripting mode to create the test script.






            share|improve this answer
























            • What is the difference/connection between TestObject and WebElement?

              – Mate Mrše
              Jan 3 at 13:50











            • TestObject is the object in Katalon and we can use it like findTestObject. WebElement is from Selenium. We need to use selenium command for it.

              – Tony Bui
              Jan 3 at 13:52











            • So, it is just a formal difference - Katalon uses one, and Selenium the other? But, it is the same thing, basically.

              – Mate Mrše
              Jan 3 at 13:54














            1












            1








            1







            WebUI object works with TestObject, not the WebElement of selenium. You could either use manual mode or scripting mode to create the test script.






            share|improve this answer













            WebUI object works with TestObject, not the WebElement of selenium. You could either use manual mode or scripting mode to create the test script.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 2 at 6:52









            Tony BuiTony Bui

            72527




            72527













            • What is the difference/connection between TestObject and WebElement?

              – Mate Mrše
              Jan 3 at 13:50











            • TestObject is the object in Katalon and we can use it like findTestObject. WebElement is from Selenium. We need to use selenium command for it.

              – Tony Bui
              Jan 3 at 13:52











            • So, it is just a formal difference - Katalon uses one, and Selenium the other? But, it is the same thing, basically.

              – Mate Mrše
              Jan 3 at 13:54



















            • What is the difference/connection between TestObject and WebElement?

              – Mate Mrše
              Jan 3 at 13:50











            • TestObject is the object in Katalon and we can use it like findTestObject. WebElement is from Selenium. We need to use selenium command for it.

              – Tony Bui
              Jan 3 at 13:52











            • So, it is just a formal difference - Katalon uses one, and Selenium the other? But, it is the same thing, basically.

              – Mate Mrše
              Jan 3 at 13:54

















            What is the difference/connection between TestObject and WebElement?

            – Mate Mrše
            Jan 3 at 13:50





            What is the difference/connection between TestObject and WebElement?

            – Mate Mrše
            Jan 3 at 13:50













            TestObject is the object in Katalon and we can use it like findTestObject. WebElement is from Selenium. We need to use selenium command for it.

            – Tony Bui
            Jan 3 at 13:52





            TestObject is the object in Katalon and we can use it like findTestObject. WebElement is from Selenium. We need to use selenium command for it.

            – Tony Bui
            Jan 3 at 13:52













            So, it is just a formal difference - Katalon uses one, and Selenium the other? But, it is the same thing, basically.

            – Mate Mrše
            Jan 3 at 13:54





            So, it is just a formal difference - Katalon uses one, and Selenium the other? But, it is the same thing, basically.

            – Mate Mrše
            Jan 3 at 13:54













            0














            Please try without using the object WebUI.
            If you can share the entire code along with the error message in the console it would be great.






            share|improve this answer




























              0














              Please try without using the object WebUI.
              If you can share the entire code along with the error message in the console it would be great.






              share|improve this answer


























                0












                0








                0







                Please try without using the object WebUI.
                If you can share the entire code along with the error message in the console it would be great.






                share|improve this answer













                Please try without using the object WebUI.
                If you can share the entire code along with the error message in the console it would be great.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 2 at 6:21









                Sagar SagarSagar Sagar

                162




                162























                    0














                    First, you define test objects like this:



                    TestObject editName = new TestObject().addProperty('xpath', ConditionType.EQUALS, '//[@id="edit-name"]')
                    TestObject editPass = new TestObject().addProperty('xpath', ConditionType.EQUALS, '//[@id="edit-pass"]')
                    TestObject userLogin = new TestObject().addProperty('xpath', ConditionType.EQUALS, '//*[@id="user-login"]/div/div/button')


                    And then use them in your script



                    WebUI.setText(editName, username) 
                    WebUI.setText(editPass, password)
                    WebUI.click(userLogin)


                    Note: I guess username and password used here are variable names, otherwise use 'username' and 'password'.



                    Note 2: you will need the following imports at the top of the script:



                    import com.kms.katalon.core.testobject.ConditionType
                    import com.kms.katalon.core.testobject.TestObject as TestObject





                    share|improve this answer
























                    • Hi It's working now Thanks,

                      – Nagendra
                      Jan 7 at 6:22













                    • If you found it useful, please accept the answer (click the checkmark next to the answer).

                      – Mate Mrše
                      Jan 7 at 7:09
















                    0














                    First, you define test objects like this:



                    TestObject editName = new TestObject().addProperty('xpath', ConditionType.EQUALS, '//[@id="edit-name"]')
                    TestObject editPass = new TestObject().addProperty('xpath', ConditionType.EQUALS, '//[@id="edit-pass"]')
                    TestObject userLogin = new TestObject().addProperty('xpath', ConditionType.EQUALS, '//*[@id="user-login"]/div/div/button')


                    And then use them in your script



                    WebUI.setText(editName, username) 
                    WebUI.setText(editPass, password)
                    WebUI.click(userLogin)


                    Note: I guess username and password used here are variable names, otherwise use 'username' and 'password'.



                    Note 2: you will need the following imports at the top of the script:



                    import com.kms.katalon.core.testobject.ConditionType
                    import com.kms.katalon.core.testobject.TestObject as TestObject





                    share|improve this answer
























                    • Hi It's working now Thanks,

                      – Nagendra
                      Jan 7 at 6:22













                    • If you found it useful, please accept the answer (click the checkmark next to the answer).

                      – Mate Mrše
                      Jan 7 at 7:09














                    0












                    0








                    0







                    First, you define test objects like this:



                    TestObject editName = new TestObject().addProperty('xpath', ConditionType.EQUALS, '//[@id="edit-name"]')
                    TestObject editPass = new TestObject().addProperty('xpath', ConditionType.EQUALS, '//[@id="edit-pass"]')
                    TestObject userLogin = new TestObject().addProperty('xpath', ConditionType.EQUALS, '//*[@id="user-login"]/div/div/button')


                    And then use them in your script



                    WebUI.setText(editName, username) 
                    WebUI.setText(editPass, password)
                    WebUI.click(userLogin)


                    Note: I guess username and password used here are variable names, otherwise use 'username' and 'password'.



                    Note 2: you will need the following imports at the top of the script:



                    import com.kms.katalon.core.testobject.ConditionType
                    import com.kms.katalon.core.testobject.TestObject as TestObject





                    share|improve this answer













                    First, you define test objects like this:



                    TestObject editName = new TestObject().addProperty('xpath', ConditionType.EQUALS, '//[@id="edit-name"]')
                    TestObject editPass = new TestObject().addProperty('xpath', ConditionType.EQUALS, '//[@id="edit-pass"]')
                    TestObject userLogin = new TestObject().addProperty('xpath', ConditionType.EQUALS, '//*[@id="user-login"]/div/div/button')


                    And then use them in your script



                    WebUI.setText(editName, username) 
                    WebUI.setText(editPass, password)
                    WebUI.click(userLogin)


                    Note: I guess username and password used here are variable names, otherwise use 'username' and 'password'.



                    Note 2: you will need the following imports at the top of the script:



                    import com.kms.katalon.core.testobject.ConditionType
                    import com.kms.katalon.core.testobject.TestObject as TestObject






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jan 2 at 7:26









                    Mate MršeMate Mrše

                    1,8922627




                    1,8922627













                    • Hi It's working now Thanks,

                      – Nagendra
                      Jan 7 at 6:22













                    • If you found it useful, please accept the answer (click the checkmark next to the answer).

                      – Mate Mrše
                      Jan 7 at 7:09



















                    • Hi It's working now Thanks,

                      – Nagendra
                      Jan 7 at 6:22













                    • If you found it useful, please accept the answer (click the checkmark next to the answer).

                      – Mate Mrše
                      Jan 7 at 7:09

















                    Hi It's working now Thanks,

                    – Nagendra
                    Jan 7 at 6:22







                    Hi It's working now Thanks,

                    – Nagendra
                    Jan 7 at 6:22















                    If you found it useful, please accept the answer (click the checkmark next to the answer).

                    – Mate Mrše
                    Jan 7 at 7:09





                    If you found it useful, please accept the answer (click the checkmark next to the answer).

                    – Mate Mrše
                    Jan 7 at 7:09


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54001962%2fhow-to-handle-webui-click-and-webui-settext-built-in-keywords-using-xpath%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

                    Does disintegrating a polymorphed enemy still kill it after the 2018 errata?

                    A Topological Invariant for $pi_3(U(n))$