Entering value into webform text box with VBA works on screen, but data not actually entered into the text...
up vote
0
down vote
favorite
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 |
up vote
0
down vote
favorite
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 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 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 at 22:24
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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 at 15:19
Jaspos
48110
48110
Have you tried using selenium basic?
– QHarr
Nov 22 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 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 at 22:24
add a comment |
Have you tried using selenium basic?
– QHarr
Nov 22 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 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 at 22:24
Have you tried using selenium basic?
– QHarr
Nov 22 at 15:21
Have you tried using selenium basic?
– QHarr
Nov 22 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 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 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 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 at 22:24
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
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 at 7:36
add a comment |
up vote
1
down vote
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 |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
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 at 7:36
add a comment |
up vote
2
down vote
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 at 7:36
add a comment |
up vote
2
down vote
up vote
2
down vote
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 at 5:48
QHarr
28.2k81839
28.2k81839
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 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 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 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 at 7:36
add a comment |
up vote
1
down vote
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 |
up vote
1
down vote
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 |
up vote
1
down vote
up vote
1
down vote
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 at 7:38
Jaspos
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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 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 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 at 22:24