I'm doing a test on a simple page that I created and runs with flask just for testing, I'm using Behave and Gherkin to create the cases. The error occurs when selenium has to fetch the form's field ID from a simple post inside the page's blog.
@when('I enter "(.*)" in the "(.*)" field')
def step_impl(context, content, field_name):
page = NewPostPage(context.driver)
page.form_field(field_name).send_keys(content)
This is the function declaration
from selenium.webdriver.common.by import By
from codes.tests.acceptance.locators.new_post_page import NewPostPageLocators
from codes.tests.acceptance.page_model.base_page import BasePage
class NewPostPage(BasePage):
def __init__(self, driver):
super().__init__(driver)
self.send_keys = None
@property
def url(self):
return super(NewPostPage, self).url + '/post'
@property
def form(self):
return self.driver.find_element(*NewPostPageLocators.NEW_POST_FORM)
@property
def submit_button(self):
return self.driver.find_element(*NewPostPageLocators.SUBMIT_BUTTON)
@property
def form_field(self, name):
return self.form.find_element(By.NAME, name)
This is the error that appears in the console, gave a print () in the fields to see what data and why it was not processing