VineGlobal / selenium-vba

Automatically exported from code.google.com/p/selenium-vba
1 stars 0 forks source link

isTextPresent unhandled exception #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
using version 1.0.5

every once in awhile the function isTextPresent raises an unhandled exception 
and I don't know why. I've got an input box asking for user input and I handle 
the case where the user enters nothing. The exception appears to tell me that 
I've supplied null to the function but that isn't really possible so I'm lost.

Is there a way for me to attach the debugger in Visual Studio 2008 to the 
running firefox called by my script? I was trying to step through everything 
but keep running into "no sourcecode available" messages when the debugger gets 
to the variable containing the seleniumwrapper.webdriver instance.

Original issue reported on code.google.com by matthewkastor@gmail.com on 18 May 2012 at 5:26

GoogleCodeExporter commented 9 years ago
ok, so I switched my project to Visual Studio 2010, downloaded the source code 
for this project, and followed the fancy prompts to browse for source code when 
the debugger asked for it while handling a different error. I was confused and 
thought . . . anyway, I can do more investigation the next time I get this 
error and give you something more specific than "umm something is messed up 
somewhere". :D

To be thorough, I should check out the selenium source code as well and make 
sure it's the same version used in this project. I've got the tortoise svn open 
and I'm looking at the selenium source, about to checkout 
http://selenium.googlecode.com/svn/tags/selenium-2.21 as the version of the 
selenium dll's all said 2.21. Let me know if I'm mistaken and need to grab a 
different version of the source.

Original comment by matthewkastor@gmail.com on 20 May 2012 at 11:50

GoogleCodeExporter commented 9 years ago
There is no point in debugging from this project sources as it mainly warps 
functions from Selenium Framework libraries. And as i binded those functions 
automatically by "Reflection", there's a pretty good chance that most of the 
defects are from Selenium libraries which I use without modification.
In version 1.0.5 referenced libraries can be found in this package:
http://code.google.com/p/selenium/downloads/detail?name=selenium-dotnet-2.21.0.z
ip

Try to reproduce the defect in a new CSharp/VBNet projet with Selenium 
libraries referenced: 

    WebDriverBackedSelenium sel = new WebDriverBackedSelenium(new InternetExplorerDriver(), @"http://www.google.com/");
    sel.Start();
    sel.Open(@"http://seleniumhq.org/projects/");
    sel.Type("name=q", "Selenium");
    Thread.Sleep(2000);
    Console.WriteLine("textpresent = " + sel.IsTextPresent("your text"));
    ...
    sel.Stop();

If you can reproduce the issue, report it to Selenium on their project website 
(http://code.google.com/p/selenium/issues/list).
In not, paste you example in this defect.

From my experience, when a command sometimes works and sometimes fails, it 
usually implies that the browser is still working on something. Try to add a 
pause/wait command before and see if you still have the exception.

Original comment by florentbr on 21 May 2012 at 6:39

GoogleCodeExporter commented 9 years ago
I am out of state right now, when I get home I'll be able to run some tests.

I saw what you were doing to wrap the C# client and did check out the 2.21 tag 
of selenium. I'm sure you're right that it's either a timing issue or a defect 
in their library. I found another issue with isTextPresent, when I try using 
regexpi to search for a case insensitive regular expression match it doesn't 
work. This one I know isn't in your wrapper at all as I'd tried it against the 
webdriver backed selenium object and had the same error.

    Dim ff As New OpenQA.Selenium.Firefox.FirefoxDriver()
    Dim selenium As New Selenium.WebDriverBackedSelenium(ff, "http://yahoo.com")

It is what it is, I suppose. I highly suspect the unhandled exception would be 
timing since it is intermittently occurring when the input "should" be correct. 
What I was doing is opening a page, checking for specific text, and using the 
result of the check to tell my program to proceed or bail out. As far as I know 
the open command automatically implies that there is a wait before proceeding. 
I'll try adding the pause as you suggested and run some tests next weekend when 
I'm back home.

Original comment by matthewkastor@gmail.com on 22 May 2012 at 4:41

GoogleCodeExporter commented 9 years ago
Nothing much to do here.

Original comment by florentbr on 26 Aug 2012 at 8:48