send_keys
を使用してフィールドを埋めると同時に、この値を変数に格納しようとしています。このコードを実行すると、変数のテキストは表示されません。Selenium + Python:テキストを変数に格納して印刷する
locators.py
from selenium.webdriver.common.by import By
class CreateNewContractor(object):
FIRST_NAME = (By.ID, "id_0-first_name")
pages.py
from locators import *
class CreateNewContractor1(Page):
def fill_contractor(self):
email = self.find_element(*CreateNewContractor.FIRST_NAME).send_keys("Hello")
email.text
print email
私はどのように保存し、メール変数で満たされたテキストを印刷することができますか?
'電子メールを。 get_attribute( 'value') ' – Andersson
@Andersson上記のオプションを試しましたが、テストに合格し、テキスト値を出力しません。 – RFtests