3

I would like to know(if possible), while using selenium for testing UI, can the selenium commands be run via chrome console(developer console) similar to running/testing xpath for example like using $x("//input[@name='inputname']") which would give the input/tag with the specified name.

Here by selenium commands, i mean for example finding a text box and typing[type ( locator,value )] a text data(value) into it, using only the chrome console and not by running the test cases/scripts ? Thanks.

2
  • 2
    I am not sure what are you trying to achieveCommentedApr 19, 2013 at 12:29
  • Hi, I just wanted to test selenium commands like filling up text boxes with text, clicking a button etc., directly from chrome console(similar to checking xpath via chrome console as mentioned earlier) instead of trying to run scripts or recording test cases.. something like $type('xpath/textboxname', 'texttobetyped') from chrome dev console would just fill the textbox with the text provided..
    – Acc Acc
    CommentedApr 22, 2013 at 5:33

2 Answers 2

1

Use the innerText, wholeText, or value properties. $x returns an array, so an index has to be specified. Here are some examples:

$x("//body")[0].innerText = 'hi' $x("//input")[0].value = 'foo' $x('//*[@id]')[3].firstChild.wholeText 

References

    0

    I tried something like $x("//input[@name='inputname']").click

      Start asking to get answers

      Find the answer to your question by asking.

      Ask question

      Explore related questions

      See similar questions with these tags.