Forum Discussion

Alamkazi's avatar
Alamkazi
New Member
3 years ago

While I am writing test cases. At the time of testing I am facing an issue.

Hi all. Below is my test case code in bdd python. So here I have written the test cases and everything is working fine But i am facing an issue with this error

 

1.  selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(Session info: chrome=94.0.4606.54)

 

*here is my code*

*.test.feature*

```

Feature: Vikreya login

Scenario: Login to vikreya with valid parameter:
Given I launch chrome browser
When i open vikreya web page
And click on login button
And enter username "aalamkazi24@gmail.com" and password "aalam@123A"
And click on submit button
Then user successfully login to the web site

```

*test.py*

```

from behave import *
from selenium import webdriver


@given('I launch chrome browser')
def launch_Browser(context):
context.driver = webdriver.Chrome()


@when('i open vikreya web page')
def open_vikreya(context):
context.driver.get("http://127.0.0.1:8000/")


@when('click on login button')
def click_login_btn(context):
context.driver.find_element_by_xpath("//body/div[1]/div[3]/button[1]").click()


@when('enter username "{user}" and password "{pwd}"')
def input_validate(context, user, pwd):
context.driver.find_element_by_id("asadSalima").send_keys(user);
context.driver.find_element_by_id("asadAlam").send_keys(pwd);


@when('click on submit button')
def click_submit(context):
context.driver.find_element_by_xpath("//button[contains(text(),'Log In')]").click()


@then('user successfully login to the web site')
def success_lunch(context):
text = context.driver.find_element_by_xpath("//span[contains(text(),'Welcome back! Alam')]").text
assert text == "Welcome back! Alam"

```