0

I am a beginner with Robot framework with Chrome. I have no problems using it but on a website developped by my colleagues, I cannot input text in a specific textfield (error message: InvalidElementStateException: Message: invalid element state). Here is my code:

*** Settings ***    
Library    SeleniumLibrary

*** Variables ***

*** Keywords ***
Create normal activity

    wait until page contains element  //*[@id="root_pagemashupcontainer-2_mashupcontainer-88_ptcsbutton-225"]
    click element    //*[@id="root_pagemashupcontainer-2_mashupcontainer-88_ptcsbutton-225"]
    wait until page contains element  //*[@id="input"]
    input text    //*[@id="input"]  ActivityName

If I inspect the textfield here is what I have:

Element inspection

I have tried :

  • Zooming out to make sure the element is fully visible
  • waiting a few seconds between each action
  • This element's xpath is "//*[@id="input"]" . It is not the only element with that Xpath so I have tried using the full Xpath and CSS of that element and the ptcs-texfield element
  • Using Katalon Recorder. It works on other web pages but on that web page, the clicks are recorded but not the text typing.

Nothing has worked.

Sandra
  • 1
  • 2
  • If you look up towards the top of that HTML you will see the element is inside of a `shadow-root`. You need to access that first before interacting with the element https://stackoverflow.com/questions/36141681/does-anybody-know-how-to-identify-shadow-dom-web-elements-using-selenium-webdriv – JD2775 May 22 '21 at 14:35
  • Which line of code is throwing the error? – Bryan Oakley May 24 '21 at 16:28
  • @JD2775 Many thanks! I got it working with this: `input text dom:document.querySelector("#root_pagemashupcontainer-2_mashupcontainer-88_mashupcontainer-207_ptcstextfield-216").shadowRoot.querySelector("#input") Hello` Now I've got a dropdown list which values are inside of a shadow-root. How can I select a value? – Sandra May 24 '21 at 20:40
  • @BryanOakley The last one. – Sandra May 24 '21 at 20:44

0 Answers0