0

For a particular text box on the page the robotframework is giving me an error that the element is not visible after I use the run command. I am basically trying to enter text in a text field but it cannot identify its location on the page.

I used locators..xpath, id and class.

xpath=//*[@id="solution-input"]

The test case I have written using robot framework:

Wait Until Element Is Visible    xpath=//*[@id="solution-input"]    20  seconds
Set Focus To Element    xpath=//*[@id="solution-input"]
Input Text    xpath=//*[@id="solution-input"]    test

HTML Snippet:

<input _ngcontent-c2="" class="col-md-6 ng-untouched ng-pristine ng-valid" id="solution-input" placeholder="Used for Opportunity Name &amp; Description" type="text">
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Johnny
  • 21
  • 1
  • 3
  • 1
    provide the code that you tried and the HTML snippet of the webelement that you are trying to access. – Alok Oct 09 '18 at 18:25
  • Welcome to Stack Overflow. Check the Stack Overflow's [help on asking questions](http://stackoverflow.com/help/asking) first, please. Focus on [What topics can I ask about here](http://stackoverflow.com/help/on-topic), [What types of questions should I avoid asking?](http://stackoverflow.com/help/dont-ask), [How to ask a good question](http://stackoverflow.com/help/how-to-ask), [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve) and [Stack Overflow question checklist](http://meta.stackoverflow.com/questions/260648/stack-overflow-question-checklist). – David Ferenczy Rogožan Oct 09 '18 at 19:03
  • Please have a read through [ask], and especially how to create a [mcve]. As your question stands, it is very difficult to give you an answer. – SiKing Oct 09 '18 at 19:04
  • sure I will take a look at it Dawid. Sorry, I am new. – Johnny Oct 09 '18 at 19:07
  • @Johnny any code accompanying your question should be appropriately edited into the question itself, not pasted in an unreadable form into a comment. – Random Davis Oct 09 '18 at 19:16
  • Ok - I realized it later and made the change. I have also deleted it from the comment section now. – Johnny Oct 09 '18 at 19:19
  • @SiKing - I made some changes. Please let me know – Johnny Oct 09 '18 at 19:22
  • Your question talks exclusively about robot framework, but you included tag [tag:selenium-webdriver]. Why? Also: "...a particular text box on the page..." could be pretty much anything anywhere; you will have to provide details. – SiKing Oct 09 '18 at 23:23
  • Because I am using Selenium Web Driver library. The text box is a like a search text box. I further found out that no elements on that page are being able to be located because the focus is not moving onto the next page. So now I this is the issue. Once we get the focus on the page we can locate the elements. – Johnny Oct 10 '18 at 00:23

1 Answers1

1

The desired element is an Angular element so you can use either/both (clubbing up) of the solutions:

  • Wait Until Element Is Visible:

    Wait Until Element Is Visible    xpath=//input[@class="col-md-6 ng-untouched ng-pristine ng-valid" and @id="solution-input"]    20  seconds
    Set Focus To Element    xpath=//*[@id="solution-input"]
    Input Text    xpath=//*[@id="solution-input"]    test
    
  • Wait Until Element Is Enabled:

    Wait Until Element Is Enabled    xpath=//input[@class="col-md-6 ng-untouched ng-pristine ng-valid" and @id="solution-input"]    20  seconds
    Set Focus To Element    xpath=//*[@id="solution-input"]
    Input Text    xpath=//*[@id="solution-input"]    test
    
  • You can find a detailed discussion about Wait Until Element Is Visible and Wait Until Element Is Enabled in Robotframework: Selenium2Lib: Wait Until (…) Keywords

  • Reference: Selenium2Library

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352