Entering value into webform text box with VBA works on screen, but data not actually entered into the text...
I have some code that works fine to enter data via Excel/VBA into webforms.
I have it working on other sites, but on this one site, the data is "entered" into the text box, as I can see it on screen.
But if I then click on the text box the data disappears. Likewise, if I click submit on the form, I get an error saying the text boxes are empty (even though, on screen, they are not).
As I say, the code I have works on other sites so it must be something about the site I am using.
FYI here's simplified code I am using, where IE is an Internet Explorer object:
IE.document.all("EntryField_hdn_547").Value = "My Name"
This is the URL of the form:
https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp
(you'll need to click through to the 3rd page, and click the "Employer" radio to see the text fields)
And this is the HTML of eg the above text entry box:
<input type="text" class="i" name="EntryField_hdn_547" tabindex="1469" aria-label="Name" style="text-align: left; vertical-align: middle; text-indent: 0px; padding: 0px 5.67px; height: 34.0157px; box-sizing: border-box; position: absolute; width: 566.93px;">
Can anyone help suggest a way to get the data to "stick" in the text boxes
(FYI I also have code to click the radio buttons, and that works fine)
Also, I tried this answer which seems very similar but still no joy:
Text entered into Webpage Search Box via Excel VBA is not detected when clicking Search button
html vba webforms inputbox
add a comment |
I have some code that works fine to enter data via Excel/VBA into webforms.
I have it working on other sites, but on this one site, the data is "entered" into the text box, as I can see it on screen.
But if I then click on the text box the data disappears. Likewise, if I click submit on the form, I get an error saying the text boxes are empty (even though, on screen, they are not).
As I say, the code I have works on other sites so it must be something about the site I am using.
FYI here's simplified code I am using, where IE is an Internet Explorer object:
IE.document.all("EntryField_hdn_547").Value = "My Name"
This is the URL of the form:
https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp
(you'll need to click through to the 3rd page, and click the "Employer" radio to see the text fields)
And this is the HTML of eg the above text entry box:
<input type="text" class="i" name="EntryField_hdn_547" tabindex="1469" aria-label="Name" style="text-align: left; vertical-align: middle; text-indent: 0px; padding: 0px 5.67px; height: 34.0157px; box-sizing: border-box; position: absolute; width: 566.93px;">
Can anyone help suggest a way to get the data to "stick" in the text boxes
(FYI I also have code to click the radio buttons, and that works fine)
Also, I tried this answer which seems very similar but still no joy:
Text entered into Webpage Search Box via Excel VBA is not detected when clicking Search button
html vba webforms inputbox
Have you tried using selenium basic?
– QHarr
Nov 22 '18 at 15:21
Not looked at that before. As I have a solution already working on other sites, I am hoping a simple tweak might get this working, rather than setting up a whole new system.
– Jaspos
Nov 22 '18 at 16:03
A lot of java script is running here. I am afraid here no simple tweak will exist and it is not possible just simply set the attributevalue
from VBA code :(.
– dee
Nov 22 '18 at 22:24
add a comment |
I have some code that works fine to enter data via Excel/VBA into webforms.
I have it working on other sites, but on this one site, the data is "entered" into the text box, as I can see it on screen.
But if I then click on the text box the data disappears. Likewise, if I click submit on the form, I get an error saying the text boxes are empty (even though, on screen, they are not).
As I say, the code I have works on other sites so it must be something about the site I am using.
FYI here's simplified code I am using, where IE is an Internet Explorer object:
IE.document.all("EntryField_hdn_547").Value = "My Name"
This is the URL of the form:
https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp
(you'll need to click through to the 3rd page, and click the "Employer" radio to see the text fields)
And this is the HTML of eg the above text entry box:
<input type="text" class="i" name="EntryField_hdn_547" tabindex="1469" aria-label="Name" style="text-align: left; vertical-align: middle; text-indent: 0px; padding: 0px 5.67px; height: 34.0157px; box-sizing: border-box; position: absolute; width: 566.93px;">
Can anyone help suggest a way to get the data to "stick" in the text boxes
(FYI I also have code to click the radio buttons, and that works fine)
Also, I tried this answer which seems very similar but still no joy:
Text entered into Webpage Search Box via Excel VBA is not detected when clicking Search button
html vba webforms inputbox
I have some code that works fine to enter data via Excel/VBA into webforms.
I have it working on other sites, but on this one site, the data is "entered" into the text box, as I can see it on screen.
But if I then click on the text box the data disappears. Likewise, if I click submit on the form, I get an error saying the text boxes are empty (even though, on screen, they are not).
As I say, the code I have works on other sites so it must be something about the site I am using.
FYI here's simplified code I am using, where IE is an Internet Explorer object:
IE.document.all("EntryField_hdn_547").Value = "My Name"
This is the URL of the form:
https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp
(you'll need to click through to the 3rd page, and click the "Employer" radio to see the text fields)
And this is the HTML of eg the above text entry box:
<input type="text" class="i" name="EntryField_hdn_547" tabindex="1469" aria-label="Name" style="text-align: left; vertical-align: middle; text-indent: 0px; padding: 0px 5.67px; height: 34.0157px; box-sizing: border-box; position: absolute; width: 566.93px;">
Can anyone help suggest a way to get the data to "stick" in the text boxes
(FYI I also have code to click the radio buttons, and that works fine)
Also, I tried this answer which seems very similar but still no joy:
Text entered into Webpage Search Box via Excel VBA is not detected when clicking Search button
html vba webforms inputbox
html vba webforms inputbox
asked Nov 22 '18 at 15:19
JasposJaspos
48110
48110
Have you tried using selenium basic?
– QHarr
Nov 22 '18 at 15:21
Not looked at that before. As I have a solution already working on other sites, I am hoping a simple tweak might get this working, rather than setting up a whole new system.
– Jaspos
Nov 22 '18 at 16:03
A lot of java script is running here. I am afraid here no simple tweak will exist and it is not possible just simply set the attributevalue
from VBA code :(.
– dee
Nov 22 '18 at 22:24
add a comment |
Have you tried using selenium basic?
– QHarr
Nov 22 '18 at 15:21
Not looked at that before. As I have a solution already working on other sites, I am hoping a simple tweak might get this working, rather than setting up a whole new system.
– Jaspos
Nov 22 '18 at 16:03
A lot of java script is running here. I am afraid here no simple tweak will exist and it is not possible just simply set the attributevalue
from VBA code :(.
– dee
Nov 22 '18 at 22:24
Have you tried using selenium basic?
– QHarr
Nov 22 '18 at 15:21
Have you tried using selenium basic?
– QHarr
Nov 22 '18 at 15:21
Not looked at that before. As I have a solution already working on other sites, I am hoping a simple tweak might get this working, rather than setting up a whole new system.
– Jaspos
Nov 22 '18 at 16:03
Not looked at that before. As I have a solution already working on other sites, I am hoping a simple tweak might get this working, rather than setting up a whole new system.
– Jaspos
Nov 22 '18 at 16:03
A lot of java script is running here. I am afraid here no simple tweak will exist and it is not possible just simply set the attribute
value
from VBA code :(.– dee
Nov 22 '18 at 22:24
A lot of java script is running here. I am afraid here no simple tweak will exist and it is not possible just simply set the attribute
value
from VBA code :(.– dee
Nov 22 '18 at 22:24
add a comment |
2 Answers
2
active
oldest
votes
This is dead easy with selenium basic. After install go VBE > Tools > References > Add a reference to selenium type library.
Option Explicit
Public Sub EnterInfo()
Dim d As WebDriver
Set d = New ChromeDriver
Const url = "https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp"
With d
.Start "Chrome"
.get url
.Window.Maximize
'.ExecuteScript "window.scrollTo(0, document.body.scrollHeight);"
.FindElementByCss(".S").Click
.FindElementByCss("#_hdn_30 > div._.widget.buttonfieldwidget.xfaButton").Click
.FindElementByCss("[aria-label=employer]").Click
.FindElementByCss("[aria-label=Name]").SendKeys "Wile E. Coyote"
.FindElementByCss("[aria-label='Name of company']").SendKeys "Acme Corporation"
.FindElementByCss("[aria-label='Position in company']").SendKeys "Entrepreneur"
.FindElementByCss("[aria-label='Telephone number']").SendKeys "012345678910"
.FindElementByCss("[tabindex='1511']").Click
.FindElementByCss("[tabindex='1537']").Click
.FindElementByCss("#_hdn_653 > div._.widget.buttonfieldwidget.xfaButton").Click
Stop
.Quit
End With
End Sub
1
Thanks QHarr - in fact, this gave me an idea, as I can use SendKeys in my code too, and that seemed to work! Selenuim looks interesting though, I will check it out when I get some time
– Jaspos
Nov 23 '18 at 7:36
add a comment |
QHarrs link provided the answer - by using SendKeys instead I could enter the data as text into the textboxes.
I did need to set the focus to IE first - I used the info here to get that bit sorted:
Set Focus to Internet Explorer Object in Visual Basic
ie
myIE.visible = false
DoEvents
myIE.visible = true
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%2f53433966%2fentering-value-into-webform-text-box-with-vba-works-on-screen-but-data-not-actu%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
This is dead easy with selenium basic. After install go VBE > Tools > References > Add a reference to selenium type library.
Option Explicit
Public Sub EnterInfo()
Dim d As WebDriver
Set d = New ChromeDriver
Const url = "https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp"
With d
.Start "Chrome"
.get url
.Window.Maximize
'.ExecuteScript "window.scrollTo(0, document.body.scrollHeight);"
.FindElementByCss(".S").Click
.FindElementByCss("#_hdn_30 > div._.widget.buttonfieldwidget.xfaButton").Click
.FindElementByCss("[aria-label=employer]").Click
.FindElementByCss("[aria-label=Name]").SendKeys "Wile E. Coyote"
.FindElementByCss("[aria-label='Name of company']").SendKeys "Acme Corporation"
.FindElementByCss("[aria-label='Position in company']").SendKeys "Entrepreneur"
.FindElementByCss("[aria-label='Telephone number']").SendKeys "012345678910"
.FindElementByCss("[tabindex='1511']").Click
.FindElementByCss("[tabindex='1537']").Click
.FindElementByCss("#_hdn_653 > div._.widget.buttonfieldwidget.xfaButton").Click
Stop
.Quit
End With
End Sub
1
Thanks QHarr - in fact, this gave me an idea, as I can use SendKeys in my code too, and that seemed to work! Selenuim looks interesting though, I will check it out when I get some time
– Jaspos
Nov 23 '18 at 7:36
add a comment |
This is dead easy with selenium basic. After install go VBE > Tools > References > Add a reference to selenium type library.
Option Explicit
Public Sub EnterInfo()
Dim d As WebDriver
Set d = New ChromeDriver
Const url = "https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp"
With d
.Start "Chrome"
.get url
.Window.Maximize
'.ExecuteScript "window.scrollTo(0, document.body.scrollHeight);"
.FindElementByCss(".S").Click
.FindElementByCss("#_hdn_30 > div._.widget.buttonfieldwidget.xfaButton").Click
.FindElementByCss("[aria-label=employer]").Click
.FindElementByCss("[aria-label=Name]").SendKeys "Wile E. Coyote"
.FindElementByCss("[aria-label='Name of company']").SendKeys "Acme Corporation"
.FindElementByCss("[aria-label='Position in company']").SendKeys "Entrepreneur"
.FindElementByCss("[aria-label='Telephone number']").SendKeys "012345678910"
.FindElementByCss("[tabindex='1511']").Click
.FindElementByCss("[tabindex='1537']").Click
.FindElementByCss("#_hdn_653 > div._.widget.buttonfieldwidget.xfaButton").Click
Stop
.Quit
End With
End Sub
1
Thanks QHarr - in fact, this gave me an idea, as I can use SendKeys in my code too, and that seemed to work! Selenuim looks interesting though, I will check it out when I get some time
– Jaspos
Nov 23 '18 at 7:36
add a comment |
This is dead easy with selenium basic. After install go VBE > Tools > References > Add a reference to selenium type library.
Option Explicit
Public Sub EnterInfo()
Dim d As WebDriver
Set d = New ChromeDriver
Const url = "https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp"
With d
.Start "Chrome"
.get url
.Window.Maximize
'.ExecuteScript "window.scrollTo(0, document.body.scrollHeight);"
.FindElementByCss(".S").Click
.FindElementByCss("#_hdn_30 > div._.widget.buttonfieldwidget.xfaButton").Click
.FindElementByCss("[aria-label=employer]").Click
.FindElementByCss("[aria-label=Name]").SendKeys "Wile E. Coyote"
.FindElementByCss("[aria-label='Name of company']").SendKeys "Acme Corporation"
.FindElementByCss("[aria-label='Position in company']").SendKeys "Entrepreneur"
.FindElementByCss("[aria-label='Telephone number']").SendKeys "012345678910"
.FindElementByCss("[tabindex='1511']").Click
.FindElementByCss("[tabindex='1537']").Click
.FindElementByCss("#_hdn_653 > div._.widget.buttonfieldwidget.xfaButton").Click
Stop
.Quit
End With
End Sub
This is dead easy with selenium basic. After install go VBE > Tools > References > Add a reference to selenium type library.
Option Explicit
Public Sub EnterInfo()
Dim d As WebDriver
Set d = New ChromeDriver
Const url = "https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp"
With d
.Start "Chrome"
.get url
.Window.Maximize
'.ExecuteScript "window.scrollTo(0, document.body.scrollHeight);"
.FindElementByCss(".S").Click
.FindElementByCss("#_hdn_30 > div._.widget.buttonfieldwidget.xfaButton").Click
.FindElementByCss("[aria-label=employer]").Click
.FindElementByCss("[aria-label=Name]").SendKeys "Wile E. Coyote"
.FindElementByCss("[aria-label='Name of company']").SendKeys "Acme Corporation"
.FindElementByCss("[aria-label='Position in company']").SendKeys "Entrepreneur"
.FindElementByCss("[aria-label='Telephone number']").SendKeys "012345678910"
.FindElementByCss("[tabindex='1511']").Click
.FindElementByCss("[tabindex='1537']").Click
.FindElementByCss("#_hdn_653 > div._.widget.buttonfieldwidget.xfaButton").Click
Stop
.Quit
End With
End Sub
answered Nov 23 '18 at 5:48
QHarrQHarr
31.6k82041
31.6k82041
1
Thanks QHarr - in fact, this gave me an idea, as I can use SendKeys in my code too, and that seemed to work! Selenuim looks interesting though, I will check it out when I get some time
– Jaspos
Nov 23 '18 at 7:36
add a comment |
1
Thanks QHarr - in fact, this gave me an idea, as I can use SendKeys in my code too, and that seemed to work! Selenuim looks interesting though, I will check it out when I get some time
– Jaspos
Nov 23 '18 at 7:36
1
1
Thanks QHarr - in fact, this gave me an idea, as I can use SendKeys in my code too, and that seemed to work! Selenuim looks interesting though, I will check it out when I get some time
– Jaspos
Nov 23 '18 at 7:36
Thanks QHarr - in fact, this gave me an idea, as I can use SendKeys in my code too, and that seemed to work! Selenuim looks interesting though, I will check it out when I get some time
– Jaspos
Nov 23 '18 at 7:36
add a comment |
QHarrs link provided the answer - by using SendKeys instead I could enter the data as text into the textboxes.
I did need to set the focus to IE first - I used the info here to get that bit sorted:
Set Focus to Internet Explorer Object in Visual Basic
ie
myIE.visible = false
DoEvents
myIE.visible = true
add a comment |
QHarrs link provided the answer - by using SendKeys instead I could enter the data as text into the textboxes.
I did need to set the focus to IE first - I used the info here to get that bit sorted:
Set Focus to Internet Explorer Object in Visual Basic
ie
myIE.visible = false
DoEvents
myIE.visible = true
add a comment |
QHarrs link provided the answer - by using SendKeys instead I could enter the data as text into the textboxes.
I did need to set the focus to IE first - I used the info here to get that bit sorted:
Set Focus to Internet Explorer Object in Visual Basic
ie
myIE.visible = false
DoEvents
myIE.visible = true
QHarrs link provided the answer - by using SendKeys instead I could enter the data as text into the textboxes.
I did need to set the focus to IE first - I used the info here to get that bit sorted:
Set Focus to Internet Explorer Object in Visual Basic
ie
myIE.visible = false
DoEvents
myIE.visible = true
answered Nov 23 '18 at 7:38
JasposJaspos
48110
48110
add a comment |
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%2f53433966%2fentering-value-into-webform-text-box-with-vba-works-on-screen-but-data-not-actu%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
Have you tried using selenium basic?
– QHarr
Nov 22 '18 at 15:21
Not looked at that before. As I have a solution already working on other sites, I am hoping a simple tweak might get this working, rather than setting up a whole new system.
– Jaspos
Nov 22 '18 at 16:03
A lot of java script is running here. I am afraid here no simple tweak will exist and it is not possible just simply set the attribute
value
from VBA code :(.– dee
Nov 22 '18 at 22:24