Robot Framework - Locating input element with accept attribute fails
I am writing an automation script for an avatar upload module with the following CSS locator:
input[accept="image/png,image/jpeg,image/gif,image/bmp"]
I am using Robot Framework's Wait Until Element Is Visible keyword to look for the locator above but is unsuccessful with the error:
Element 'css=input[accept="image/png,image/jpeg,image/gif,image/bmp"]' not visible after 30 seconds.
Increasing the timeout also doesn't work. Using the same in Chrome Dev Tools would successfully find the element. My guess is that the commas/slashes are messing with Robot's locator parsing. My question is: What is the correct way to write the locator?
selenium automated-tests robotframework
add a comment |
I am writing an automation script for an avatar upload module with the following CSS locator:
input[accept="image/png,image/jpeg,image/gif,image/bmp"]
I am using Robot Framework's Wait Until Element Is Visible keyword to look for the locator above but is unsuccessful with the error:
Element 'css=input[accept="image/png,image/jpeg,image/gif,image/bmp"]' not visible after 30 seconds.
Increasing the timeout also doesn't work. Using the same in Chrome Dev Tools would successfully find the element. My guess is that the commas/slashes are messing with Robot's locator parsing. My question is: What is the correct way to write the locator?
selenium automated-tests robotframework
1
The content of the locator is used as is, RF doesn't have any issues with the commas or the slashes. It should be something else - the element is shown after some interaction, or it is simply not visible, just present - a more "stylized" span or div is what the user sees. Try withPage Should Contain Element
.
– Todor Minakov
Nov 20 '18 at 5:07
@Todor I changed the validation to use the keyword Wait Until Page Contains Element and it worked! It looks like Selenium/Robot recognizes input tags that are not text fields as not visible even though they appear in the DOM.
– jeffsia
Nov 20 '18 at 5:27
add a comment |
I am writing an automation script for an avatar upload module with the following CSS locator:
input[accept="image/png,image/jpeg,image/gif,image/bmp"]
I am using Robot Framework's Wait Until Element Is Visible keyword to look for the locator above but is unsuccessful with the error:
Element 'css=input[accept="image/png,image/jpeg,image/gif,image/bmp"]' not visible after 30 seconds.
Increasing the timeout also doesn't work. Using the same in Chrome Dev Tools would successfully find the element. My guess is that the commas/slashes are messing with Robot's locator parsing. My question is: What is the correct way to write the locator?
selenium automated-tests robotframework
I am writing an automation script for an avatar upload module with the following CSS locator:
input[accept="image/png,image/jpeg,image/gif,image/bmp"]
I am using Robot Framework's Wait Until Element Is Visible keyword to look for the locator above but is unsuccessful with the error:
Element 'css=input[accept="image/png,image/jpeg,image/gif,image/bmp"]' not visible after 30 seconds.
Increasing the timeout also doesn't work. Using the same in Chrome Dev Tools would successfully find the element. My guess is that the commas/slashes are messing with Robot's locator parsing. My question is: What is the correct way to write the locator?
selenium automated-tests robotframework
selenium automated-tests robotframework
asked Nov 20 '18 at 3:19
jeffsiajeffsia
1041316
1041316
1
The content of the locator is used as is, RF doesn't have any issues with the commas or the slashes. It should be something else - the element is shown after some interaction, or it is simply not visible, just present - a more "stylized" span or div is what the user sees. Try withPage Should Contain Element
.
– Todor Minakov
Nov 20 '18 at 5:07
@Todor I changed the validation to use the keyword Wait Until Page Contains Element and it worked! It looks like Selenium/Robot recognizes input tags that are not text fields as not visible even though they appear in the DOM.
– jeffsia
Nov 20 '18 at 5:27
add a comment |
1
The content of the locator is used as is, RF doesn't have any issues with the commas or the slashes. It should be something else - the element is shown after some interaction, or it is simply not visible, just present - a more "stylized" span or div is what the user sees. Try withPage Should Contain Element
.
– Todor Minakov
Nov 20 '18 at 5:07
@Todor I changed the validation to use the keyword Wait Until Page Contains Element and it worked! It looks like Selenium/Robot recognizes input tags that are not text fields as not visible even though they appear in the DOM.
– jeffsia
Nov 20 '18 at 5:27
1
1
The content of the locator is used as is, RF doesn't have any issues with the commas or the slashes. It should be something else - the element is shown after some interaction, or it is simply not visible, just present - a more "stylized" span or div is what the user sees. Try with
Page Should Contain Element
.– Todor Minakov
Nov 20 '18 at 5:07
The content of the locator is used as is, RF doesn't have any issues with the commas or the slashes. It should be something else - the element is shown after some interaction, or it is simply not visible, just present - a more "stylized" span or div is what the user sees. Try with
Page Should Contain Element
.– Todor Minakov
Nov 20 '18 at 5:07
@Todor I changed the validation to use the keyword Wait Until Page Contains Element and it worked! It looks like Selenium/Robot recognizes input tags that are not text fields as not visible even though they appear in the DOM.
– jeffsia
Nov 20 '18 at 5:27
@Todor I changed the validation to use the keyword Wait Until Page Contains Element and it worked! It looks like Selenium/Robot recognizes input tags that are not text fields as not visible even though they appear in the DOM.
– jeffsia
Nov 20 '18 at 5:27
add a comment |
2 Answers
2
active
oldest
votes
Though present in the DOM, an element may not be visible/rendered. This is very often the case with file upload input
elements - the UI renders something different, a button
, div
that had applied styling and fits in better with the overall design.
Thus a check is it visible will rightfully fail. Change your pre-usage approach to validate the input
is in the HTML - this is actually the same as what you did in the browser's dev tools - with the Page Should Contain Element
keyword, and proceed on success.
add a comment |
There is no problem with the CSS locator your are using. Maybe the element is in another iframe?
The content is not inside an iframe. There are other element likes buttons grouped inside the same div as the input element and I can find them just fine.
– jeffsia
Nov 20 '18 at 5:17
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385720%2frobot-framework-locating-input-element-with-accept-attribute-fails%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Though present in the DOM, an element may not be visible/rendered. This is very often the case with file upload input
elements - the UI renders something different, a button
, div
that had applied styling and fits in better with the overall design.
Thus a check is it visible will rightfully fail. Change your pre-usage approach to validate the input
is in the HTML - this is actually the same as what you did in the browser's dev tools - with the Page Should Contain Element
keyword, and proceed on success.
add a comment |
Though present in the DOM, an element may not be visible/rendered. This is very often the case with file upload input
elements - the UI renders something different, a button
, div
that had applied styling and fits in better with the overall design.
Thus a check is it visible will rightfully fail. Change your pre-usage approach to validate the input
is in the HTML - this is actually the same as what you did in the browser's dev tools - with the Page Should Contain Element
keyword, and proceed on success.
add a comment |
Though present in the DOM, an element may not be visible/rendered. This is very often the case with file upload input
elements - the UI renders something different, a button
, div
that had applied styling and fits in better with the overall design.
Thus a check is it visible will rightfully fail. Change your pre-usage approach to validate the input
is in the HTML - this is actually the same as what you did in the browser's dev tools - with the Page Should Contain Element
keyword, and proceed on success.
Though present in the DOM, an element may not be visible/rendered. This is very often the case with file upload input
elements - the UI renders something different, a button
, div
that had applied styling and fits in better with the overall design.
Thus a check is it visible will rightfully fail. Change your pre-usage approach to validate the input
is in the HTML - this is actually the same as what you did in the browser's dev tools - with the Page Should Contain Element
keyword, and proceed on success.
edited Nov 20 '18 at 6:11
answered Nov 20 '18 at 5:52
Todor MinakovTodor Minakov
7,18012538
7,18012538
add a comment |
add a comment |
There is no problem with the CSS locator your are using. Maybe the element is in another iframe?
The content is not inside an iframe. There are other element likes buttons grouped inside the same div as the input element and I can find them just fine.
– jeffsia
Nov 20 '18 at 5:17
add a comment |
There is no problem with the CSS locator your are using. Maybe the element is in another iframe?
The content is not inside an iframe. There are other element likes buttons grouped inside the same div as the input element and I can find them just fine.
– jeffsia
Nov 20 '18 at 5:17
add a comment |
There is no problem with the CSS locator your are using. Maybe the element is in another iframe?
There is no problem with the CSS locator your are using. Maybe the element is in another iframe?
answered Nov 20 '18 at 5:13
thanh lethanh le
1796
1796
The content is not inside an iframe. There are other element likes buttons grouped inside the same div as the input element and I can find them just fine.
– jeffsia
Nov 20 '18 at 5:17
add a comment |
The content is not inside an iframe. There are other element likes buttons grouped inside the same div as the input element and I can find them just fine.
– jeffsia
Nov 20 '18 at 5:17
The content is not inside an iframe. There are other element likes buttons grouped inside the same div as the input element and I can find them just fine.
– jeffsia
Nov 20 '18 at 5:17
The content is not inside an iframe. There are other element likes buttons grouped inside the same div as the input element and I can find them just fine.
– jeffsia
Nov 20 '18 at 5:17
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385720%2frobot-framework-locating-input-element-with-accept-attribute-fails%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
The content of the locator is used as is, RF doesn't have any issues with the commas or the slashes. It should be something else - the element is shown after some interaction, or it is simply not visible, just present - a more "stylized" span or div is what the user sees. Try with
Page Should Contain Element
.– Todor Minakov
Nov 20 '18 at 5:07
@Todor I changed the validation to use the keyword Wait Until Page Contains Element and it worked! It looks like Selenium/Robot recognizes input tags that are not text fields as not visible even though they appear in the DOM.
– jeffsia
Nov 20 '18 at 5:27