Selenium driven web browser shows a different date format than normally
When Selenium is not controlling the web browsers I see a date-time
of the format:%a %d %b %Y, %I:%M %p
as expected.
e.g. Wed 21 Nov 2018, 10:58 am
When Selenium is controlling the web browsers I see a date-time
such as:
e.g. Nov. 21, 2018, 10:58 a.m.
Why is this Happening? What can I do to fix this?
FURTHER INFORMATION:
When I manually test this in Chrome and Firefox I always get the correct date format.
When I run my automated Selenium with Behave and Python test case to verify the text in the field which contains the date, I get a different format. The screenshots captured on test failure also show this incorrect date format.
I have used break point to pause the test and have a look myself. I can clearly see the incorrect date format.
The date-time itself is the correct date-time, just in incorrect format when selenium is controlling the web browser.
python python-2.7 selenium datetime-format python-behave
add a comment |
When Selenium is not controlling the web browsers I see a date-time
of the format:%a %d %b %Y, %I:%M %p
as expected.
e.g. Wed 21 Nov 2018, 10:58 am
When Selenium is controlling the web browsers I see a date-time
such as:
e.g. Nov. 21, 2018, 10:58 a.m.
Why is this Happening? What can I do to fix this?
FURTHER INFORMATION:
When I manually test this in Chrome and Firefox I always get the correct date format.
When I run my automated Selenium with Behave and Python test case to verify the text in the field which contains the date, I get a different format. The screenshots captured on test failure also show this incorrect date format.
I have used break point to pause the test and have a look myself. I can clearly see the incorrect date format.
The date-time itself is the correct date-time, just in incorrect format when selenium is controlling the web browser.
python python-2.7 selenium datetime-format python-behave
could there be a date configuration needed to be initialised in selenium?
– MEdwin
Nov 21 '18 at 11:40
Update the question with your code trials and relevant HTML.
– DebanjanB
Nov 21 '18 at 12:21
Are you running both of these tests on the same machine? I seriously doubt Selenium control has anything to do with it. More likely is when you run this manually, you are logging into a profile that has certain settings, etc. that is controlling this and when you run this using Selenium you have no profile.
– JeffC
Nov 21 '18 at 15:45
What do you mean by "manually test this in Chrome and Firefox"? Do you just go to the website and see that the date-time format is different? If so, it's possible that there's JavaScript updating the page and reformatting the date-time format.
– natn2323
Nov 23 '18 at 16:25
add a comment |
When Selenium is not controlling the web browsers I see a date-time
of the format:%a %d %b %Y, %I:%M %p
as expected.
e.g. Wed 21 Nov 2018, 10:58 am
When Selenium is controlling the web browsers I see a date-time
such as:
e.g. Nov. 21, 2018, 10:58 a.m.
Why is this Happening? What can I do to fix this?
FURTHER INFORMATION:
When I manually test this in Chrome and Firefox I always get the correct date format.
When I run my automated Selenium with Behave and Python test case to verify the text in the field which contains the date, I get a different format. The screenshots captured on test failure also show this incorrect date format.
I have used break point to pause the test and have a look myself. I can clearly see the incorrect date format.
The date-time itself is the correct date-time, just in incorrect format when selenium is controlling the web browser.
python python-2.7 selenium datetime-format python-behave
When Selenium is not controlling the web browsers I see a date-time
of the format:%a %d %b %Y, %I:%M %p
as expected.
e.g. Wed 21 Nov 2018, 10:58 am
When Selenium is controlling the web browsers I see a date-time
such as:
e.g. Nov. 21, 2018, 10:58 a.m.
Why is this Happening? What can I do to fix this?
FURTHER INFORMATION:
When I manually test this in Chrome and Firefox I always get the correct date format.
When I run my automated Selenium with Behave and Python test case to verify the text in the field which contains the date, I get a different format. The screenshots captured on test failure also show this incorrect date format.
I have used break point to pause the test and have a look myself. I can clearly see the incorrect date format.
The date-time itself is the correct date-time, just in incorrect format when selenium is controlling the web browser.
python python-2.7 selenium datetime-format python-behave
python python-2.7 selenium datetime-format python-behave
edited Nov 21 '18 at 13:02
Ali AzG
7131616
7131616
asked Nov 21 '18 at 11:38
GraceGrace
1
1
could there be a date configuration needed to be initialised in selenium?
– MEdwin
Nov 21 '18 at 11:40
Update the question with your code trials and relevant HTML.
– DebanjanB
Nov 21 '18 at 12:21
Are you running both of these tests on the same machine? I seriously doubt Selenium control has anything to do with it. More likely is when you run this manually, you are logging into a profile that has certain settings, etc. that is controlling this and when you run this using Selenium you have no profile.
– JeffC
Nov 21 '18 at 15:45
What do you mean by "manually test this in Chrome and Firefox"? Do you just go to the website and see that the date-time format is different? If so, it's possible that there's JavaScript updating the page and reformatting the date-time format.
– natn2323
Nov 23 '18 at 16:25
add a comment |
could there be a date configuration needed to be initialised in selenium?
– MEdwin
Nov 21 '18 at 11:40
Update the question with your code trials and relevant HTML.
– DebanjanB
Nov 21 '18 at 12:21
Are you running both of these tests on the same machine? I seriously doubt Selenium control has anything to do with it. More likely is when you run this manually, you are logging into a profile that has certain settings, etc. that is controlling this and when you run this using Selenium you have no profile.
– JeffC
Nov 21 '18 at 15:45
What do you mean by "manually test this in Chrome and Firefox"? Do you just go to the website and see that the date-time format is different? If so, it's possible that there's JavaScript updating the page and reformatting the date-time format.
– natn2323
Nov 23 '18 at 16:25
could there be a date configuration needed to be initialised in selenium?
– MEdwin
Nov 21 '18 at 11:40
could there be a date configuration needed to be initialised in selenium?
– MEdwin
Nov 21 '18 at 11:40
Update the question with your code trials and relevant HTML.
– DebanjanB
Nov 21 '18 at 12:21
Update the question with your code trials and relevant HTML.
– DebanjanB
Nov 21 '18 at 12:21
Are you running both of these tests on the same machine? I seriously doubt Selenium control has anything to do with it. More likely is when you run this manually, you are logging into a profile that has certain settings, etc. that is controlling this and when you run this using Selenium you have no profile.
– JeffC
Nov 21 '18 at 15:45
Are you running both of these tests on the same machine? I seriously doubt Selenium control has anything to do with it. More likely is when you run this manually, you are logging into a profile that has certain settings, etc. that is controlling this and when you run this using Selenium you have no profile.
– JeffC
Nov 21 '18 at 15:45
What do you mean by "manually test this in Chrome and Firefox"? Do you just go to the website and see that the date-time format is different? If so, it's possible that there's JavaScript updating the page and reformatting the date-time format.
– natn2323
Nov 23 '18 at 16:25
What do you mean by "manually test this in Chrome and Firefox"? Do you just go to the website and see that the date-time format is different? If so, it's possible that there's JavaScript updating the page and reformatting the date-time format.
– natn2323
Nov 23 '18 at 16:25
add a comment |
0
active
oldest
votes
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%2f53411255%2fselenium-driven-web-browser-shows-a-different-date-format-than-normally%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f53411255%2fselenium-driven-web-browser-shows-a-different-date-format-than-normally%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
could there be a date configuration needed to be initialised in selenium?
– MEdwin
Nov 21 '18 at 11:40
Update the question with your code trials and relevant HTML.
– DebanjanB
Nov 21 '18 at 12:21
Are you running both of these tests on the same machine? I seriously doubt Selenium control has anything to do with it. More likely is when you run this manually, you are logging into a profile that has certain settings, etc. that is controlling this and when you run this using Selenium you have no profile.
– JeffC
Nov 21 '18 at 15:45
What do you mean by "manually test this in Chrome and Firefox"? Do you just go to the website and see that the date-time format is different? If so, it's possible that there's JavaScript updating the page and reformatting the date-time format.
– natn2323
Nov 23 '18 at 16:25