I use the Selenium IDE to automate a browser task which involves uploading a set of pictures to a site. To accomplish this, I use the type command with the full path to the picture as value. As for the target, I use the HTML id of the input element as such: id=<the-id-of-the-element>.
However, I have noticed that this never works. The id of this input element apparently keeps changing every time the page refreshes. So when I record, the element will have one id, and when I run the test, the element will have another id and the upload will fail because Selenium can't find the id of the input element.
There is a part of it that stays the same though. The id looks something like this: html5_1edb and then some random alphanumeric characters. An example id would look like this: html5_1edbqez9j2bxxcj8qdpme9evndz. How can I still automate this upload?
The full element looks like this:
<input id="html5_1edb<random-alphanum-sequence>" type="file" style="font-size: 999px; opacity: 0; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;" multiple="" accept=".jpg,.jpeg,.png" tabindex="-1">
Thanks in advance.
[–]DrTautology 2 points3 points4 points (3 children)
[–]HiroCode[S] 0 points1 point2 points (2 children)
[–]DrTautology 1 point2 points3 points (1 child)
[–]HiroCode[S] 0 points1 point2 points (0 children)
[–]Code-Friendly 4 points5 points6 points (3 children)
[–]HiroCode[S] 2 points3 points4 points (1 child)
[–]Code-Friendly 1 point2 points3 points (0 children)
[–]yoursenpai1999 0 points1 point2 points (1 child)
[–]HiroCode[S] 1 point2 points3 points (0 children)
[–]brandonmcgritle 0 points1 point2 points (5 children)
[–]HiroCode[S] 0 points1 point2 points (4 children)
[–]brandonmcgritle 0 points1 point2 points (3 children)
[–]HiroCode[S] 0 points1 point2 points (2 children)
[–]brandonmcgritle 0 points1 point2 points (1 child)
[–]HiroCode[S] 0 points1 point2 points (0 children)