I am trying to automate the JDE oracle to Excel. In edge Browser i use below code to add number into the filed but i get element not found error.
Sub JDE()
Dim OBJ As New WebDriver
OBJ.Start "edge", ""
OBJ.Get "https://jdecitrix.xxx.com/jde/E1Menu.maf"
OBJ.FindElementByName("qbe0_1.0").SendKeys ("123456")
End Sub
Pictures are attached
HTML code
JDE table Web page
Related
I've got a problem with one case that I want to resolve.
I've a web-page with 3 tables that are loaded by clicking the button (ajax response). User is selecting the date ranges and after button is clicked data is populated to tables.
What I want to do is to take those tables into excel using VBA, so within one click I can copy those tables from page to excel.
I've searched the internet, but didn't found something that regards to similar issue.
Currently I've macro to download those tables, but by default they are empty, so the code downloads only headers.
Option Explicit
Sub GetData()
Dim H As Object, B$, D As Object, C As Object
Set C = CreateObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
Set D = CreateObject("HTMLFile")
Set H = CreateObject("WinHTTP.WinHTTPRequest.5.1")
H.SetAutoLogonPolicy 0
H.Open "GET", "https://mywebpage.com"
H.Send
D.body.innerHTML = H.ResponseText
C.SetText D.getElementById("table").outerHTML
C.PutInClipboard
Worksheets("sheet1").[A1].PasteSpecial
Worksheets("sheet1").Cells.Hyperlinks.Delete
End Sub
Does anyone have some idea how to call ajax function (with time parameters that are chosen in the page) from the excel visual basic?
I have Recorded a VB test script in TestComplete 11.0 and did some changes in our web application. when i was running the recorded test script, i didnt get any errors in log file which was generated by TestComplete but changes are not reflecting in our application.
Here is the VB Test Script:
Sub Test1
Dim browser
Dim page
Dim form
Dim textbox
Dim table
TestedApps.XXXcm.Run
Call Browsers.Item(btIExplorer).Navigate("http://localhost/XXXcm/connect.asp")
Set browser = Aliases.browser
Set page = browser.pageXXXConfigurationManager
Set form = page.formConnectform
Set textbox = form.textboxUsername
Call textbox.Drag(89, 12, -244, 6)
Call textbox.SetText("admin")
Call textbox.Keys("[Tab]")
Set table = form.tableYYYYtable
Call table.passwordboxPwd.SetText("XXXX")
table.submitbuttonLogin.ClickButton
page.Wait
Set page = browser.pageXXXConfigurationManagerField
Set textbox = page.tableDbfieldtable.cellColrubrik.textboxShortname
Call textbox.Click(85, 12)
Call page.Keys(" ")
Call textbox.SetText("Mobileno")
delay(5000)
page.buttonSave.ClickButton
page.Wait
End Sub
Could you please suggest me on this.
Thanks and Regards,
Sailaja
Try replacing SetText with Keys. SetText sets the text programmatically and may not trigger some keyboard events that you application may be listening to. Keys simulates actual typing on a keyboard.
To always record tests using Keys, go to Tools > Options > Engines > Recording and change the Record text input... option to Keys.
I have a dev express report. I want to search for all controls on the report.
The normal convension in windows forms would be:
foreach (Control c in Control.ControlCollection)
{
........
}
Unfortunately this will not work in Dev Express form. Any solutions?
Thanks
There are lots of such questions regarding to find control in report or highlighting cell on mouse over etc..
xrLabel1.Text = ((XRLabel)((XtraReport)xrSubreport1.ReportSource).FindControl("xrLabel1", false)).Text;
subreport control - Check attached sample here
How can set the text of a label on a Subreport?
Check this code snippet to take some idea for your functionality..
Private Sub XtraReport1_BeforePrint(ByVal sender As Object, ByVal e As
System.Drawing.Printing.PrintEventArgs)
Dim collection As XRControlCollection = (CType(CType(sender, DevExpress.XtraReports.UI.XtraReport),
Q274540.XtraReport1)).Detail.Controls
For i As Integer = 0 To collection.Count - 1
If TypeOf collection(i) Is XRLabel Then
If (CType(collection(i), XRLabel)).DataBindings.Count <> 0 Then
'your code here
End If
End If
Next i
End Sub
XRControl.BeforePrint Event
Report have some structure and you have find control at particular container as you do you in GridView. e.g. find control in editTemplate .. the particular container of the control
Check these links get more information about this:
Loop thru controls of Report or find all visible strings
Find TableCell Controls inside a report
Find all databound controls on report
Hello I am writing code in VB6 only (no VB.NET)
I have webbrowsercontrol object named webbrowser1
I have added reference of microsoft html object library in project.
I am trying this line but is giving error.
Dim doc as MSHTML.HTMLDocument
doc = DirectCast(webbrowser1.document, MSHTML.HTMLDocument)
line 2 is giving error that no method or data found at MSHTML.HTMLDocument
Please help me solving this problem.
What I want is I have one webpage having 2 (html forms) in it. I am loading that page into
webbrowser control by,
webbrowser1.navigate "url"
I have mapped event to handle html button click in webbrowser1's document.
When user clicks on this button I want to submit second form of html page.
Is there any other way to do it?
I also tried following code
'this line is working properly
'this is the code to submit first form in html page
webbrowser1.document.Forms(0).submit
but when I do
'this line is giving error though there are 2 forms available in html page
webbrowser1.document.Forms(1).submit
So ultimate goal is to submit second form of html document.
Please show me right direction.
You need to change Dim doc as MSHTML.HTMLDocument to Dim doc as MSHTML.IHTMLDocument.
Notice the IHTMLDocument has an I at the start, then try to submit the form.
Also, there is no such thing as DirectCast in VB6 - that is only a VB.NET thing.
So just do this:
Dim doc as MSHTML.IHTMLDocument
Set doc = webbrowser1.document
Now you will get intellisense on doc. :)
Let me know how it goes.
Have you tried just direct assignment?
Dim doc as MSHTML.HTMLDocument
Set doc = webbrowser1.document
VB6 doesn't really do casting, but you can access any method (early bound) by assigning it to an variable of the required type, or (late bound) by blindly using a variable of Object type.
Hey all, I've been trying to find the code that allowed me to capture an entire web page using the webbrowser1 control and i believe also a picturebox or 2.. but i am not able to find the code that i used a couple months ago! I've been goodgling until I'm all googled out!
If anyone knows of the code for VB6 then please post a link to it!.
Thanks,
David
Do you mean the HTML source? If so you can add a reference to the Microsoft HTML obj Library and;
Dim doc As MSHTML.HTMLDocument
set doc = YourWebBrowserCtrl.Document
msgbox doc.documentElement.outerHTML
However this will not return the exact source as at this point its been parsed by IE. (It also won't include doc type or anything else preceding the opening <html> tag.
If you do want the source, add an internet transfer control and just call .openURL to get the full content.
Dim DrawSize As New Size(1024, 768)
Using MyBrowser As New WebBrowser
MyBrowser.ScrollBarsEnabled = False
MyBrowser.Size = DrawSize
MyBrowser.Navigate("http://www.stackoverflow.com")
While MyBrowser.ReadyState <> WebBrowserReadyState.Complete
Application.DoEvents()
End While
Using myBitmap As New Bitmap(DrawSize.Width, DrawSize.Height)
MyBrowser.DrawToBitmap(myBitmap, New Rectangle(New Point(0, 0), DrawSize))
myBitmap.Save("C:\test.jpeg")
End Using
End Using