SeleniumBasic icon indicating copy to clipboard operation
SeleniumBasic copied to clipboard

Selenium Exception: VBA with Firefox

Open mde00435 opened this issue 7 years ago • 2 comments

Hello,

I've been working with selenium in VBA for about 2 weeks and I finally got it to the stage where is was reliably navivgating Firefox and downloading the desired information. Once the code was finished I started running it several times to ensure it wouldn't break. After about the third time of running it I got the below error message from selenium. (screenshot attached below error)

image

Additionally VBA flagged up the following error simultaneously:

image

It was running fine and I didn't make any alterations with the code whilst in this phase of testing. I'm not farmilair with this kind of problem so if anyone has any more information they can provide to help me solve this issue I'd be very grateful!

Many thanks, Tom

mde00435 avatar Jun 18 '18 12:06 mde00435

When you click on "Debug" what is the line in VBA on which it failed? And if you then continue execution, does it fail again or continue as expected? I also get some inconsistent error messages from time to time for code that has been working for months. Most often this is due to a new Chrome update in which case I simply update my Chromedriver and all is well again.

I also discovered some issues with some background javascript that interferes with my VBA script. My assumption is that some javascript (ajax call) may trigger an update to the DOM which conflicts with the original DOM my VBA script is trying to access. In most of these cases the background javascript is triggered by specific UI actions triggered by previous VBA commands. In such a case, the javascript may need some time to complete before VBA can successfully continue.. If my VBA script tries to access the DOM in certain ways while the background javascript is still running in the background, it may fail with some cryptic error message. Sometimes the background script completes so quickly that it does not interfere with the VBA at all. It might be perfectly fine until one day the javascript just executes a little bit slower than usual, perhaps due to a slow network connection, and then causes the VBA script to fail.

The problem is to identify those cases where such a background activity is still active when your next VBA command is executed and to avoid VBA from issuing any further actions until the javascript completed. Sometimes, if you are very lucky, these background actions would display some indication that something is happening (e.g. "Loading..." icon or something similar). In this case I simply add a while loop after my VBA action (the one that triggers the javascript) to check if the "Loading..." icon is visible and if so, pause 1 second and loop. Effectively only continuing my VBA script if I am sure there is no background javascript running.

On 18 June 2018 at 14:18, mde00435 [email protected] wrote:

Hello,

I've been working with selenium in VBA for about 2 weeks and I finally got it to the stage where is was reliably navivgating Firefox and downloading the desired information. Once the code was finished I started running it several times to ensure it wouldn't break. After about the third time of running it I got the below error message from selenium. (screenshot attached below error)

[image: image] https://user-images.githubusercontent.com/40358085/41535255-8caa5a90-72f9-11e8-800a-62978eaa5582.png

Additionally VBA flagged up the following error simultaneously:

[image: image] https://user-images.githubusercontent.com/40358085/41535338-dce39698-72f9-11e8-81f4-a29277e483bf.png

It was running fine and I didn't make any alterations with the code whilst in this phase of testing. I'm not farmilair with this kind of problem so if anyone has any more information they can provide to help me solve this issue I'd be very grateful!

Many thanks, Tom

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/florentbr/SeleniumBasic/issues/172, or mute the thread https://github.com/notifications/unsubscribe-auth/AJlnWigP9z3nql8k7g5sfBt46iwDE8Trks5t95p8gaJpZM4UrpJM .

Jottie avatar Jun 18 '18 15:06 Jottie

It continuously trips up on: driver.Get "https://www.ebay.co.uk/", Raise = False

If I then try to resume execution it trips up on the same line above. I might also add that this it is able to run the following code before it trips up: Set driver = New FirefoxDriver driver.SetProfile "default", persistant:=True driver.SetBinary "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" driver.SetPreference "browser.download.folderList", 2 driver.SetPreference "browser.download.dir", "C:\Users\Tom\Documents\1. Ebay\3. SoTo Shop\1. Order CSVs\1. To Process"

I have heard that these issues can spontaneously occur; however I read that Salenium is not compatible with later version of Firefox. Consequently I downloaded version 34 and I disabled automatic updates; however I have just check and somehow I am running version 43...

Could this be effecting it? Do you know what is the latest version selenium Firefox is compatible with?

With regards to your comments about the clash between VBA and Java, I do understand what you mean. I'm not familiar with Java but it makes sense. In my case I'm only running 5 lines of code before the troublesome line. I wouldn't know what to set the while loop to look for, since nothing has been initialised. Where and what would I look for to indicate java is still carrying out an action?

Thank you for your help! Tom

mde00435 avatar Jun 18 '18 21:06 mde00435