|
-
Nov 15th, 2012, 11:45 AM
#1
Thread Starter
Lively Member
Webbrowser script error: Invalid argument
Hey
I'm making a program that i call "CheatyCheater".
It is a webbrowser designed to make it easier to cheat on tests. (electronic tests).
When i press a button, the first webbrowser is hidden, and a new one appears.
The second browser is ment to be a groupchat for the class. So we can exchange awnsers.
However when i press the button, and the second browser navigates to the chat-website the following error appears: (Error is translated from norwegian an may not be 100% accurate)
Script error
An error has occurred in the script on this page.
Line: 36
Sign: 3
Error: Invalid Argument
Kode: 0
URL: https://chatstep.com/file.js
How can i get rid of this error? I need to get this working!
The site seemed perfect for the purpose i want!
-
Nov 15th, 2012, 12:57 PM
#2
Thread Starter
Lively Member
Re: Webbrowser script error: Invalid argument
Ehm...
fixed it :P
Was annoyingly simple.
Problem now:
on the site (https://chatstep.com/) the "join" button has no name o.O
how can i press this? I'm stuck... Thanks in advance
(I will create another topic dedicated to this problem aswell, so it will be easier for people googling the same problem to find)
Last edited by TeachMeVB; Nov 15th, 2012 at 01:04 PM.
-
Nov 15th, 2012, 01:08 PM
#3
Re: Webbrowser script error: Invalid argument
the "join" button has no name
It has an ID!
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Nov 15th, 2012, 01:47 PM
#4
Thread Starter
Lively Member
Re: Webbrowser script error: Invalid argument
 Originally Posted by dunfiddlin
It has an ID!
-.-' dont you think i know that?
i tried the line:
WebBrowser1.Document.GetElementByID("joinButton").invokeMember("click")
But it did not work... so... any other bright ideas?
(Even if it says ".GetElementByID" it looks for the name, atleast i was told so. Seems to be accurate)
-
Nov 15th, 2012, 01:55 PM
#5
Re: Webbrowser script error: Invalid argument
Well, you obviously get told a lot of nonsense then. If it doesn't find the element it throws an exception so the problem is obviously not that you can't find the button but that it doesn't operate on "click". This is not uncommon with scripted buttons. I have had some success using "onclick" instead and if that doesn't work I've also tried what is effectively a double click, varying the period between the two clicks. And then again there are some buttons that just won't be clicked other than by an actual mouse.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Nov 15th, 2012, 02:03 PM
#6
Thread Starter
Lively Member
Re: Webbrowser script error: Invalid argument
 Originally Posted by dunfiddlin
Well, you obviously get told a lot of nonsense then. If it doesn't find the element it throws an exception so the problem is obviously not that you can't find the button but that it doesn't operate on "click". This is not uncommon with scripted buttons. I have had some success using "onclick" instead and if that doesn't work I've also tried what is effectively a double click, varying the period between the two clicks. And then again there are some buttons that just won't be clicked other than by an actual mouse.
Found the problem :P
I solved the scripterror by suppressing the error. So now i tried manually clicking the "join" button with the webbrowser in .visible = true mode, and nothing happend...
So theres the problem. Script error. The button wont be pressed. Why? pls help with this problem
-
Nov 15th, 2012, 03:58 PM
#7
Re: Webbrowser script error: Invalid argument
Nothing to be done, I'm afraid. The site is just very badly scripted and fails on IE proper so there's no chance of the renderer getting this right. You could try one of the other browsers available for VS or use another site but you'd be doing a lot of people a favour if you complained to the site's coders that it breaks Internet Explorer rendering and demanded that they do something about it!
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Nov 16th, 2012, 02:36 AM
#8
Thread Starter
Lively Member
Re: Webbrowser script error: Invalid argument
what do you mean "try another browser available for VS"? How do i do that?
-
Nov 16th, 2012, 04:13 AM
#9
Re: Webbrowser script error: Invalid argument
He means use some other 3rd party WebBrowser control like maybe one based on Gekko(FireFox) or WebKit(Google Chrome) because Trident(IE) cannot run this script.....However, I don't think its worth the trouble of finding because the script would probably fail there too.
-
Nov 16th, 2012, 05:23 AM
#10
Thread Starter
Lively Member
Re: Webbrowser script error: Invalid argument
 Originally Posted by Niya
He means use some other 3rd party WebBrowser control like maybe one based on Gekko(FireFox) or WebKit(Google Chrome) because Trident(IE) cannot run this script.....However, I don't think its worth the trouble of finding because the script would probably fail there too.
You don't think its worth the trouble beacuse other will fail 2?
Well... when i found the page i used chrome (google), and 5 min ago, i tried viewing the page in internet explorer 9, and it failed.
So if chrome runs it, but not IE, why shouldn't it work to use the 3rd party browser of "WebKit"? I wanna try atleast. The page seemed PERFECT for its purpose.
Please help me. (and thanks for all the usefull replies so far)
-
Nov 16th, 2012, 06:09 AM
#11
Re: Webbrowser script error: Invalid argument
Oh it works in Chrome....well now you'd have to hope to God someone made something in .Net like the WebBrowser control that uses WebKit. Maybe someone has something over at SourceForge. That's the best I can say on this topic. Sorry, I couldn't help you more.
-
Nov 16th, 2012, 09:12 AM
#12
Thread Starter
Lively Member
Re: Webbrowser script error: Invalid argument
 Originally Posted by Niya
Oh it works in Chrome....well now you'd have to hope to God someone made something in .Net like the WebBrowser control that uses WebKit. Maybe someone has something over at SourceForge. That's the best I can say on this topic. Sorry, I couldn't help you more.
Thanks for the help to both of you.
And i'll pray, you can be sure of that 
I'll do some googling, and maybe create some topics in some forums... I'll see what i can find.
Feel free to help me look :P
-
Nov 16th, 2012, 09:46 AM
#13
Thread Starter
Lively Member
Re: Webbrowser script error: Invalid argument
 Originally Posted by Niya
Oh it works in Chrome....well now you'd [...] say on this topic. Sorry, I couldn't help you more.
Ehm... found this: http://tutorialsvb.blogspot.no/2010/...itbrowser.html
It seems very ok. However, im not that good at coding.... So could someone please remove the parts of the code that requiers me to have any buttons/textboxes...?
I want a simple browser that lets me do what i command it to via code. No buttons.
(+ As i said in the original post. I got two Web browsers, if i make one work via webkit, will the other one have to be adapted to webkit aswell!? Im so confused...)
Anyway... If your to lazy to read the text at the URL i provided, here are the details needed:
The site tells me to add these buttons/textboxes...
Code:
name: buttonback text: Back
name: buttonforward text: Forward
name: buttonsr text: Stop
name: buttongo text: Go anchor: top right
name: buttonSearch text: Search anchor: top right
name: urltxt anchor: left top right autocompletemode: SuggestAppend autocompletesource: allurl
name: searchtxt anchor: top right autocompletemode: SuggestAppend autocompletesource: historylist
And here is the code im told to add:
Code:
Private Sub Buttonback_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Buttonback.Click
WebBrowser.GoBack()
End Sub
Private Sub buttongo_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles buttongo.Click
WebBrowser.Navigate(urltxt.Text)
End Sub
Private Sub Buttonsr_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles Buttonsr.Click
If Buttonsr.Text = "Stop" Then
WebBrowser.Stop()
ElseIf Buttonsr.Text = "Refresh" Then
WebBrowser.Navigate(WebBrowser.Url.ToString) ' Then
refresh the browser
End If
End Sub
Private Sub Buttonforward_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Buttonforward.Click
WebBrowser.GoForward()
End Sub
Private Sub buttonsearch_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles buttonsearch.Click
WebBrowser.Navigate("http://www.google.com/search?hl=en&
source=hp&q=" & searchtxt.Text) ' Search Google
End Sub
Private Sub WebBrowser_DocumentCompleted(ByVal sender As
Object, ByVal e As System.Windows.Forms.
WebBrowserDocumentCompletedEventArgs) Handles WebBrowser.
DocumentCompleted
Try
urltxt.Text = WebBrowser.Url.AbsoluteUri
Catch ex As Exception
WebBrowser.Navigate("http://google.com")
End Try
Me.Text = WebBrowser.DocumentTitle & " | Webkit Browser"
Buttonsr.Text = "Refresh"
End Sub
Private Sub WebBrowser_DownloadBegin(ByVal sender As
Object, ByVal e As WebKit.FileDownloadBeginEventArgs)
Handles WebBrowser.DownloadBegin
Process.Start
(e.Download.FilePath.ToString)
End Sub
Private Sub WebBrowser_Navigating(ByVal sender As Object,
ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs)
Handles WebBrowser.Navigating
Buttonsr.Text = "Stop"
End Sub
Private Sub WebBrowser_NewWindowRequest(ByVal sender As
Object, ByVal e As WebKit.NewWindowRequestEventArgs) Handles
WebBrowser.NewWindowRequest
Dim frm As New Form1
frm.Show()
frm.WebBrowser.Navigate(e.Url.ToString)
End Sub
Private Sub searchtxt_KeyDown(ByVal sender As Object, ByVal
e As System.Windows.Forms.KeyEventArgs) Handles searchtxt.KeyDown
If e.KeyCode = Keys.Enter Then
WebBrowser.Navigate("http://www.google.com/search?hl=en&
source=hp&q=" & searchtxt.Text)
End If
End Sub
Private Sub urltxt_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles urltxt.KeyDown
If e.KeyCode = Keys.Enter Then
WebBrowser.Navigate(urltxt.Text)
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
WebBrowser.TabStop = True
WebBrowser.TabIndex = 1
Buttonback.TabStop = False
Buttonforward.TabStop = False
Buttonsr.TabStop = False
buttongo.TabStop = False
buttonsearch.TabStop = False
Me.WindowState = FormWindowState.Maximized
End Sub
Please help...
-
Nov 16th, 2012, 10:05 AM
#14
Re: Webbrowser script error: Invalid argument
That's a very good find. It should be able to help others that have problems with the normal .Net one which has been reported numerous time here to have a memory leak bug. As for your question......I don't understand what you're asking.
-
Nov 16th, 2012, 10:21 AM
#15
Thread Starter
Lively Member
Re: Webbrowser script error: Invalid argument
 Originally Posted by Niya
That's a very good find. It should be able to help others that have problems with the normal .Net one which has been reported numerous time here to have a memory leak bug. As for your question......I don't understand what you're asking.
Ehm.. okay...
On my program, i got 2 webbrowsers. One for googling awnsers and such, and another one for the chat (The one running the chat needs to be webkit, not the other one).
So if i make the "chat-browser" use webkit, will the first browser turn webkit aswell? And will the webkit browser(s) use the same coding as normal .Net browsers?
-
Nov 16th, 2012, 01:07 PM
#16
Re: Webbrowser script error: Invalid argument
Well I wouldn't know....I've never used it. They should have some form of documentation for it and from there you experiment. That's how you learn stuff like this.
-
Nov 16th, 2012, 02:47 PM
#17
Re: Webbrowser script error: Invalid argument
Well before you get carried away, I've been unable to get the webkit browser control to work on VS2010 despite trying everything I know. It was written in VS2008, while Webkit itself is only compatible with 2005!!! Basically the whole project has been out of date for a long time.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Nov 16th, 2012, 04:41 PM
#18
Thread Starter
Lively Member
Re: Webbrowser script error: Invalid argument
 Originally Posted by dunfiddlin
Well before you get carried away, I've been unable to get the webkit browser control to work on VS2010 despite trying everything I know. It was written in VS2008, while Webkit itself is only compatible with 2005!!!  Basically the whole project has been out of date for a long time.
Realy!? (( God damn it...
Well how about Gekko then? (firefox). Will that work?
(Will try WebKit tomorrow. Haven't got the time now.)
But anyway...
If any of you have firefox, pls try going to www.chatstep.com and create a chatroom. Tell me if it works or not. (If it doesn't theres no point in trying Gekko. Atleast for now).
*EDIT*
I wont have time today either... This has turned out to be a very busy weekend :/ But tomorrow (Sunday) I will definatly have time for it.
Last edited by TeachMeVB; Nov 17th, 2012 at 07:39 AM.
-
Nov 17th, 2012, 11:46 AM
#19
Thread Starter
Lively Member
Re: Webbrowser script error: Invalid argument
 Originally Posted by dunfiddlin
Well before you get carried away, I've been unable to get the webkit browser control to work on VS2010 despite trying everything I know. It was written in VS2008, while Webkit itself is only compatible with 2005!!!  Basically the whole project has been out of date for a long time.
Well, now ive tested WebKit... and... well... i'm unsure if it works :-P I can browse the web and all, and i've tried navigating to www.chatstep.com but it happens the same as it did with the original browser.
How can i test that it's really running WebKit and not original VS webbrowser?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|