2

I have create a feature file and step definition file, to execute by test cases using behave (BDD ), but i am facing one error, when i execute the feature file, Please find below to check by code :-

first_behave.feature

Feature: My First behave feature

  Scenario: Add two numbers
    Given : I have two integers a and b
    When : I add the Numbers
    Then : I print the addition result

environement.py

from selenium import webdriver

def before_all(context):
     print("Executing before all")

def before_feature(context, feature):
     print("Before feature\n")

#Scenario level objects are popped off context when scenario exits
def before_scenario(context,Scenario):
    context.browser = webdriver.Chrome()
    print("Before scenario\n")

def after_scenario(context,scenario):
    context.browser.quit()
    print("After scenario\n")

def after_feature(context,feature):
     print("\nAfter feature")

def after_all(context):
     print("Executing after all")

first_behave.py

from behave import *
use_step_matcher("re")

@given("I have two integers a and b")
def step_impl(context):
    context.a = 1
    context.b = 2


@when("I add the Numbers")
def step_impl(context):
    context.sum = int(context.a) + int(context.b)


@then("I print the addition result")
def step_impl(context):
    print("Sum of", context.a, "and", context.b, "is: ", context.sum

and below is the error, i am facing:

[0806/114406.139:ERROR:gl_surface_egl.cc(690)] eglInitialize D3D9 failed with er ror EGL_NOT_INITIALIZED [0806/114406.140:ERROR:gl_initializer_win.cc(240)] GLSurfaceEGL::InitializeOneOf f failed. [0806/114406.161:ERROR:gpu_child_thread.cc(174)] Exiting GPU process due to erro rs during initialization [6120:5660:0806/114406.273:ERROR:browser_gpu_channel_host_factory.cc(103)] Faile d to launch GPU process. Before scenario

Please help me to solve this error.

0

Your example feature does not use the browser, but your code does:

context.browser = webdriver.Chrome()

The error you are getting is from Chrome, not from your test. For some reason the hardware acceleration is giving issues.

I would try the following things:

  • Remove the webdriver code as your example does not need it.
  • Update Chrome, the chromedriver and your operating system to the latest versions.
  • Add the --use-gl=desktop as an argument for starting Chrome to disable hardware-acceleration. Read this for how-to do that with python.

Now I am typing this I am wondering if you system has a GPU. You are not working on a virtual machine without hardware 3d-acceleration, are you? Probably you are.

  • Thank you Niels, for helping me.. You are right, it was a browser issue, i am using 32 bit chrome, in this one it didn't work. But when i tried to execute it on 64 bit browser, it worked perfectly.. Thank you for the quick reply.. – Santosh Kumar G Aug 7 '17 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.