Unfortunately, I can not use existing XPath / Attributes.
Xpath:Attributes and Xpath:idrelative can not be used as the ID’s are refreshing after each release.
Position cannot be used as it highlights 5 cells and is choosing any of these cells but not the correct one.
Unfortunately I get the following two error messages, dependent I click the element or set text.
Any idea, what it means and how to fix it? Set text.txt (5.6 KB) Click element.txt (5.9 KB)
Caused by: org.openqa.selenium.InvalidElementStateException: invalid element state
and
Caused by: org.openqa.selenium.ElementNotInteractableException: element not interactable
It seems your element is not able to take input or be clicked at the time you do it, like the element is in a read-only state. When you enter text manually, do you need to do anything beforehand? Did you get the correct element to highlight when you tested the pathway? One of the <div> tags in your picture is hidden, so you do not want that one.
To verify your pathway by highlighting it, in your HTML window, click on it and hit CTRL + F. Then, copy and paste the pathway into the Find/Search textbox.
Edit: to the right of the Find/Search textbox, after you enter the pathway, you should see “1 of 1” (hopefully). If you see anything else, then we may not have an unique pathway. If you see nothing to the right, then we don’t have a valid pathway.
I experimented a bit and found this attribute //*[@data-cid = ‘1$7’] . Now I am able to move to and click each cell. Unfortunately I cannot write any text in it as I get the following error message: error message.txt (5.7 KB)
The cell is div, I tried to find other properties, but couldn’t find any. Maybe you have an idea?
Again, you are getting a similar error that you had with the previous time that you tried to enter text into a cell.
Caused by: org.openqa.selenium.ElementNotInteractableException: element not interactable
How do you enter text into the spreadsheet when you do it manually? Do you have to click on a cell and then type some text? However you do it manually, that is how you have to do it via your script. In some instances, like if this is a SalesForce application, a page will only respond after you do something, such as click on a cell. The ability to “setText” does not exist until then.
WebUI.click(...)
WebUI.waitForElementClickable(...)
WebUI.delay(1) // don't know how long to wait
WebUI.setText(...)
Edit: In a SalesForce sample site, I even tried to write a pathway to an element and couldn’t get it to work. I had to use the Web Spy to get a pathway, and it was a very fragile looking pathway at that. When I tried to click to look at the HTML, the pathway did not exist until after I had clicked on the element.
But the webspy didn’t record any of the data entered (only for the dropdown it recognized an input and the entered text. For all other fields it only recognized the click, but not for 4 different fields - only for the same field entered.
First, you import all necessary packages related to xls/xlsx and then then write code for how to set values into each column and rows using setValueToCellByIndex(dataSheet, rowIndex, 24)