0

I'm doing performance testing with JMeter Python using JSR223 sampler. I want to know the following.

  1. How to connect to existing browser window?
  2. How to calculate performance timing? Suppose I have 10 steps in Python code. I want to calculate timing from step 3 to step 5.
  3. How to call methods from one JSR223 sampler to another?

Kindly help me with it.

Thanks.

Bikramjeet Singh
  • 681
  • 1
  • 7
  • 22

1 Answers1

0
  1. If the browser was triggered from Selenium you can determine its sessionid like:

    self.driver.session_id
    

    and then start another WebDriver instance providing the aforementioned session_id as the parameter:

    driver = webdriver.Remote(command_executor=url,desired_capabilities={})
    driver.session_id = session_id
    

    if the browser wasn't kicked off via Selenium - it's not possible.

  2. You can use Transaction Controller to measure the cumulative execution time of its children

    enter image description here

  3. You can put your shared logic into a separate .py file and use sys.path to load it where required like:

    from sys import path
    path.append(path_to_your_shared_module)
    
    import YourSharedModule
    
    //call functions from the shared module
    
Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Thanks for the response. Consider I'm placing an order in browser, and i want to keep each step in separate JSR223 sampler. Will JMeter automatically determine the browser session and execute selenium steps accordingly? – Unknown Mar 16 '19 at 10:27