Code Monkey home page Code Monkey logo

Comments (5)

wkeeling avatar wkeeling commented on May 20, 2024 4

Thanks @juhoarvid

FYI version 1.0.8 is now available which contains a configurable timeout option. You can set a specific value or use None for no timeout. A default of 5 seconds is used if the option is omitted entirely.

options = {
    'connection_timeout': None  # Never timeout
}
driver = webdriver.Firefox(seleniumwire_options=options)

With regard to the 502 status, the tracebacks are in fact indirectly logged by the self.send_error(502) call (it calls log_error() in its super class). But, Selenium Wire intercepts that call and logs the message and traceback at debug level. So it's possible that you're not seeing the tracebacks if you don't have your logging set to debug - e.g.

import logging
logging.basicConfig(level=logging.DEBUG)  # Set to debug to see tracebacks

The reason for using debug level is to reduce a lot of harmless "noise" that may otherwise alarm users.

from selenium-wire.

wkeeling avatar wkeeling commented on May 20, 2024

Thanks for raising this. Currently the timeout value isn't configurable (hard coded to 5 seconds) but it would definitely make sense to make it configurable for situations such as this.

I'll make the change and update this issue once it's available.

from selenium-wire.

juhoarvid avatar juhoarvid commented on May 20, 2024

I was really needing that change and was planning to check do I have anything to give with my python skills. After taking 1.0.6 in use, I notice problem disappears even there is still that hardcoded timeout defined:
https://github.com/wkeeling/selenium-wire/blob/6bb6c61/seleniumwire/proxy/proxy2.py#L38

But that value is not used at all. Probably meaning no timeouts used for proxy bindings and therefore I did not face problem anymore with 1.0.6.

But If proxy timeout needed I still think this my ticket is valid.

from selenium-wire.

wkeeling avatar wkeeling commented on May 20, 2024

Thanks @juhoarvid - I think you've found a bug. Looks as though the variable name was changed in an earlier refactoring but is no longer used, so the default of no timeout is taking effect. I guess we should probably fix that and also make the value configurable at the same time.

from selenium-wire.

juhoarvid avatar juhoarvid commented on May 20, 2024

One comment to this.

After using selenium-wire 1.0.6 I phase 502 in certain conditions. I am using Robot Framework for doing test automation. Tests fails due to exceptions on robot framework implementation. Tracebacks which leads to 502 are not shown. After this issue I am thinking, should traceback which leads to 502 be shown? In this issue it at least seems not to be server issue and therefore 502 is misleading debugging (https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502)

Probably:

except Exception:

        except Exception:
            if origin in self.tls.conns:
                del self.tls.conns[origin]
            self.send_error(502)
            return

Could be
(import traceback)

        except Exception:
            if origin in self.tls.conns:
                del self.tls.conns[origin]
            self.send_error(502)
            traceback.print_exc()
            return

or

        except Exception as e:
            if origin in self.tls.conns:
                del self.tls.conns[origin]
            self.send_error(502)
            raise e

Or exception splitted to smaller part where different type of situations are handled with different error code. For instance #55 (comment) mention that Nginx returns in certain condition 499 while selenium-wire do 502.

from selenium-wire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.