使用Gemini实现AI驱动UI自动化测试

安装依赖

pip install browser-use langchain-google-genai pydantic

编写代码

# coding=utf-8
import asyncio
import os

from browser_use.agent.service import Agent
from langchain_google_genai import ChatGoogleGenerativeAI
from pydantic import SecretStr


async def Validation():
    task = (
        'Important : I am an UI Automation Tester validating the task'
        'open website https://www.automationexercise.com/'
        'Navigate to Sign Up / Login page'
        'Create an account with Name Gaurav Singh and use random details and set password Test!@#123'
        'The "Account Created!" message should be shown'
    )

    os.environ["GEMINI_API_KEY"] = "your_api_key"
    api_key = os.environ["GEMINI_API_KEY"]

    llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", api_key=SecretStr(api_key))
    agent = Agent(task, llm, use_vision=True)
    history = await agent.run()
    result = history.final_result()
    print(history)


if __name__ == "__main__":
    asyncio.run(Validation())

执行测试

从输出结果来看测试执行成功了,还是挺智能的

/Users/wan/PycharmProjects/droidrun-demo/venv/bin/python /Users/wan/PycharmProjects/droidrun-demo/demo1.py
INFO     [telemetry] Anonymized telemetry enabled. See https://docs.browser-use.com/development/telemetry for more information.
/Users/wan/PycharmProjects/droidrun-demo/venv/lib/python3.11/site-packages/browser_use/agent/service.py:616: RuntimeWarning: coroutine 'Agent._detect_best_tool_calling_method..test_all_methods' was never awaited
  return method
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
INFO     [agent]  Starting a browser-use agent v0.2.4 with base_model=models/gemini-2.0-flash +tools +vision +memory extraction_model=None 
WARNING  [agent] ⚠️ Agent(enable_memory=True) is set but missing some required packages, install and re-run to use memory features: pip install browser-use[memory]
INFO     [agent]  Starting task: Important : I am an UI Automation Tester validating the taskopen website https://www.automationexercise.com/Navigate to Sign Up / Login pageCreate an account with Name Gaurav Singh and use random details and set password Test!@#123The "Account Created!" message should be shown
INFO     [browser]  Launching local browser driver=playwright channel=chromium user_data_dir=~/.config/browseruse/profiles/default
INFO     [agent]  Step 1: Evaluating page with 0 interactive elements on: about:blank
================================================================================
INFO     [agent]  LLM call => ChatGoogleGenerativeAI [✉️ 7 msg, ~3229 tk, 22469 char,  img] => JSON out +  20 tools (function_calling)
INFO     [agent] ❓ Eval: Unknown - I am starting a new task, so I don't know if the previous goal was successful.
INFO     [agent]  Memory: I have no memory yet.
INFO     [agent]  Next goal: Navigate to the website https://www.automationexercise.com/
INFO     [controller]   Navigated to https://www.automationexercise.com/
INFO     [agent] ☑️ Executed action 1/1: go_to_url
INFO     [agent]  Step 2: Ran 1 actions in 17.68s: ✅ 1
INFO     [agent]  Step 2: Evaluating page with 20 interactive elements on: https://www.automationexercise.com/
================================================================================
INFO     [agent]  LLM call => ChatGoogleGenerativeAI [✉️ 10 msg, ~3647 tk, 1149157 char,  img] => JSON out +  20 tools (function_calling)
INFO     [agent]  Eval: Success - I successfully navigated to the website.
INFO     [agent]  Memory: I navigated to the website https://www.automationexercise.com/.
INFO     [agent]  Next goal: Navigate to Sign Up / Login page
INFO     [controller] ️  Clicked button with index 4: Signup / Login
INFO     [agent] ☑️ Executed action 1/1: click_element_by_index
INFO     [agent]  Step 3: Ran 1 actions in 13.19s: ✅ 1
INFO     [agent]  Step 3: Evaluating page with 15 interactive elements on: https://www.automationexercise.com/login
================================================================================
INFO     [agent]  LLM call => ChatGoogleGenerativeAI [✉️ 13 msg, ~3767 tk, 166529 char,  img] => JSON out +  20 tools (function_calling)
INFO     [agent]  Eval: Success - I successfully navigated to the Sign Up / Login page.
INFO     [agent]  Memory: I navigated to the website https://www.automationexercise.com/ and then clicked on the Sign Up / Login button.
INFO     [agent]  Next goal: Create an account with Name Gaurav Singh and use random details
INFO     [controller] ⌨️  Input Gaurav Singh into index 12
INFO     [agent] ☑️ Executed action 1/2: input_text
INFO     [controller] ⌨️  Input [email protected] into index 13
INFO     [agent] ☑️ Executed action 2/2: input_text
INFO     [agent]  Step 4: Ran 2 actions in 8.71s: ✅ 2
INFO     [agent]  Step 4: Evaluating page with 15 interactive elements on: https://www.automationexercise.com/login
================================================================================
INFO     [agent]  LLM call => ChatGoogleGenerativeAI [✉️ 17 msg, ~3978 tk, 175803 char,  img] => JSON out +  20 tools (function_calling)
INFO     [agent]  Eval: Success - I have successfully entered the name and email address for the new user.
INFO     [agent]  Memory: I navigated to the website https://www.automationexercise.com/, clicked on the Sign Up / Login button, and entered the name and email address for the new user.
INFO     [agent]  Next goal: Click the signup button.
INFO     [controller] ️  Clicked button with index 14: Signup
INFO     [agent] ☑️ Executed action 1/1: click_element_by_index
INFO     [agent]  Step 5: Ran 1 actions in 6.49s: ✅ 1
INFO     [agent]  Step 5: Evaluating page with 29 interactive elements on: https://www.automationexercise.com/signup
================================================================================
INFO     [agent]  LLM call => ChatGoogleGenerativeAI [✉️ 20 msg, ~4517 tk, 199387 char,  img] => JSON out +  20 tools (function_calling)
INFO     [agent]  Eval: Success - I clicked the signup button.
INFO     [agent]  Memory: I navigated to the website https://www.automationexercise.com/, clicked on the Sign Up / Login button, entered the name and email address for the new user, and then clicked the signup button.
INFO     [agent]  Next goal: Fill in the account information form.
INFO     [controller] ️  Clicked button with index 12: 
INFO     [agent] ☑️ Executed action 1/8: click_element_by_index
INFO     [controller] ⌨️  Input Test!@#123 into index 20
INFO     [agent] ☑️ Executed action 2/8: input_text
INFO     [controller] selected option 1 with value ['1'] in frame 0
INFO     [agent] ☑️ Executed action 3/8: select_dropdown_option
INFO     [controller] selected option January with value ['1'] in frame 0
INFO     [agent] ☑️ Executed action 4/8: select_dropdown_option
INFO     [controller] selected option 2000 with value ['2000'] in frame 0
INFO     [agent] ☑️ Executed action 5/8: select_dropdown_option
INFO     [controller] ️  Clicked button with index 25: 
INFO     [agent] ☑️ Executed action 6/8: click_element_by_index
INFO     [controller] ️  Clicked button with index 27: 
INFO     [agent] ☑️ Executed action 7/8: click_element_by_index
INFO     [controller]  Scrolled down the page by 500 pixels
INFO     [agent] ☑️ Executed action 8/8: scroll_down
INFO     [agent]  Step 6: Ran 8 actions in 14.82s: ✅ 8
INFO     [agent]  Step 6: Evaluating page with 21 interactive elements on: https://www.automationexercise.com/signup
================================================================================
INFO     [agent]  LLM call => ChatGoogleGenerativeAI [✉️ 30 msg, ~4931 tk, 133032 char,  img] => JSON out +  20 tools (function_calling)
INFO     [agent]  Eval: Success - I have filled in the basic account information.
INFO     [agent]  Memory: I navigated to the website https://www.automationexercise.com/, clicked on the Sign Up / Login button, entered the name and email address for the new user, clicked the signup button, and filled in the basic account information.
INFO     [agent]  Next goal: Fill in the address information.
INFO     [controller] ⌨️  Input Gaurav into index 11
INFO     [agent] ☑️ Executed action 1/9: input_text
INFO     [controller] ⌨️  Input Singh into index 13
INFO     [agent] ☑️ Executed action 2/9: input_text
INFO     [controller] ⌨️  Input Example Inc into index 15
INFO     [agent] ☑️ Executed action 3/9: input_text
INFO     [controller] ⌨️  Input 123 Main St into index 17
INFO     [agent] ☑️ Executed action 4/9: input_text
INFO     [controller] ⌨️  Input Apt 4B into index 19
INFO     [agent] ☑️ Executed action 5/9: input_text
ERROR    [agent] ❌ Result failed 1/3 times:
 Error executing action select_dropdown_option: 21
INFO     [agent]  Step 7: Ran 1 actions in 12.71s: ❌ 1
INFO     [agent]  Step 7: Evaluating page with 21 interactive elements on: https://www.automationexercise.com/signup
================================================================================
INFO     [agent]  LLM call => ChatGoogleGenerativeAI [✉️ 33 msg, ~5260 tk, 155853 char,  img] => JSON out +  20 tools (function_calling)
INFO     [agent] ⚠️ Eval: Failed - I failed to fill in the address information because the bot was unable to select the country.
INFO     [agent]  Memory: I navigated to the website https://www.automationexercise.com/, clicked on the Sign Up / Login button, entered the name and email address for the new user, clicked the signup button, and filled in the basic account information. I then attempted to fill in the address information, but the bot was unable to select the country.
INFO     [agent]  Next goal: Select the country.
ERROR    [agent] ❌ Result failed 2/3 times:
 Error executing action select_dropdown_option: 21
INFO     [agent]  Step 8: Ran 1 actions in 4.54s: ❌ 1
INFO     [agent]  Step 8: Evaluating page with 21 interactive elements on: https://www.automationexercise.com/signup
================================================================================
INFO     [agent]  LLM call => ChatGoogleGenerativeAI [✉️ 36 msg, ~5504 tk, 154360 char,  img] => JSON out +  20 tools (function_calling)
INFO     [agent] ⚠️ Eval: Failed - I failed to fill in the address information because the bot was unable to select the country.
INFO     [agent]  Memory: I navigated to the website https://www.automationexercise.com/, clicked on the Sign Up / Login button, entered the name and email address for the new user, clicked the signup button, and filled in the basic account information. I then attempted to fill in the address information, but the bot was unable to select the country.
INFO     [agent]  Next goal: Select the country.
INFO     [controller]  Scrolled down the page by 500 pixels
INFO     [agent] ☑️ Executed action 1/5: scroll_down
INFO     [agent] Something new appeared after action 1 / 5
INFO     [agent]  Step 9: Ran 2 actions in 6.14s: ✅ 2
INFO     [agent]  Step 9: Evaluating page with 17 interactive elements on: https://www.automationexercise.com/signup
================================================================================
INFO     [agent]  LLM call => ChatGoogleGenerativeAI [✉️ 40 msg, ~5519 tk, 110674 char,  img] => JSON out +  20 tools (function_calling)
INFO     [agent]  Eval: Success - I have filled in the basic account information.
INFO     [agent]  Memory: I navigated to the website https://www.automationexercise.com/, clicked on the Sign Up / Login button, entered the name and email address for the new user, clicked the signup button, and filled in the basic account information.
INFO     [agent]  Next goal: Fill in the address information.
INFO     [controller] selected option Canada with value ['Canada'] in frame 0
INFO     [agent] ☑️ Executed action 1/6: select_dropdown_option
INFO     [controller] ⌨️  Input Ontario into index 8
INFO     [agent] ☑️ Executed action 2/6: input_text
INFO     [controller] ⌨️  Input Toronto into index 10
INFO     [agent] ☑️ Executed action 3/6: input_text
INFO     [controller] ⌨️  Input M1M 1M1 into index 12
INFO     [agent] ☑️ Executed action 4/6: input_text
INFO     [controller] ⌨️  Input 1234567890 into index 14
INFO     [agent] ☑️ Executed action 5/6: input_text
INFO     [controller] ️  Clicked button with index 15: Create Account
INFO     [agent] ☑️ Executed action 6/6: click_element_by_index
INFO     [agent]  Step 10: Ran 6 actions in 15.76s: ✅ 6
INFO     [agent]  Step 10: Evaluating page with 11 interactive elements on: https://www.automationexercise.com/account_created
================================================================================
INFO     [agent]  LLM call => ChatGoogleGenerativeAI [✉️ 48 msg, ~5778 tk, 200698 char,  img] => JSON out +  20 tools (function_calling)
INFO     [agent]  Eval: Success - I have successfully created the account.
INFO     [agent]  Memory: I navigated to the website https://www.automationexercise.com/, clicked on the Sign Up / Login button, entered the name and email address for the new user, clicked the signup button, filled in the basic account information, and then filled in the address information. Finally, I clicked the Create Account button.
INFO     [agent]  Next goal: Verify that the Account Created! message is shown.
INFO     [agent] ☑️ Executed action 1/1: done
INFO     [agent]  Result: I have successfully created an account with the name Gaurav Singh and a random email address. The password was set to Test!@#123. The Account Created! message was shown.
INFO     [agent]  Step 11: Ran 1 actions in 6.00s: ✅ 1
INFO     [agent] ✅ Task completed successfully
INFO     [browser]  Stopped the chromium browser keep_alive=False user_data_dir=~/.config/browseruse/profiles/default cdp_url=None pid=27479
AgentHistoryList(all_results=[ActionResult(is_done=False, success=None, extracted_content='  Navigated to https://www.automationexercise.com/', error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content='️  Clicked button with index 4: Signup / Login', error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content='⌨️  Input Gaurav Singh into index 12', error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content='⌨️  Input [email protected] into index 13', error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content='️  Clicked button with index 14: Signup', error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content='️  Clicked button with index 12: ', error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content='⌨️  Input Test!@#123 into index 20', error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content="selected option 1 with value ['1']", error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content="selected option January with value ['1']", error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content="selected option 2000 with value ['2000']", error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content='️  Clicked button with index 25: ', error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content='️  Clicked button with index 27: ', error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content=' Scrolled down the page by 500 pixels', error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content=None, error='Error executing action select_dropdown_option: 21', include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content=None, error='Error executing action select_dropdown_option: 21', include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content=' Scrolled down the page by 500 pixels', error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content='Something new appeared after action 1 / 5', error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content="selected option Canada with value ['Canada']", error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content='⌨️  Input Ontario into index 8', error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content='⌨️  Input Toronto into index 10', error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content='⌨️  Input M1M 1M1 into index 12', error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content='⌨️  Input 1234567890 into index 14', error=None, include_in_memory=True), ActionResult(is_done=False, success=None, extracted_content='️  Clicked button with index 15: Create Account', error=None, include_in_memory=True), ActionResult(is_done=True, success=True, extracted_content='I have successfully created an account with the name Gaurav Singh and a random email address. The password was set to Test!@#123. The Account Created! message was shown.', error=None, include_in_memory=False)], all_model_outputs=[{'go_to_url': {'url': 'https://www.automationexercise.com/'}, 'interacted_element': None}, {'click_element_by_index': {'index': 4}, 'interacted_element': DOMHistoryElement(tag_name='a', xpath='html/body/header/div/div/div/div[2]/div/ul/li[4]/a', highlight_index=4, entire_parent_branch_path=['header', 'div', 'div', 'div', 'div', 'div', 'ul', 'li', 'a'], attributes={'href': '/login'}, shadow_root=False, css_selector='html > body > header > div > div > div > div:nth-of-type(2) > div > ul > li:nth-of-type(4) > a[href="/login"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'input_text': {'index': 12, 'text': 'Gaurav Singh'}, 'interacted_element': DOMHistoryElement(tag_name='input', xpath='html/body/section/div/div/div[3]/div/form/input[2]', highlight_index=12, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'input'], attributes={'type': 'text', 'data-qa': 'signup-name', 'placeholder': 'Name', 'name': 'name', 'value': '', 'required': ''}, shadow_root=False, css_selector='html > body > section > div > div > div:nth-of-type(3) > div > form > input:nth-of-type(2)[type="text"][data-qa="signup-name"][placeholder="Name"][name="name"][required]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'input_text': {'index': 13, 'text': '[email protected]'}, 'interacted_element': DOMHistoryElement(tag_name='input', xpath='html/body/section/div/div/div[3]/div/form/input[3]', highlight_index=13, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'input'], attributes={'type': 'email', 'data-qa': 'signup-email', 'placeholder': 'Email Address', 'name': 'email', 'value': '', 'required': ''}, shadow_root=False, css_selector='html > body > section > div > div > div:nth-of-type(3) > div > form > input:nth-of-type(3)[type="email"][data-qa="signup-email"][placeholder="Email Address"][name="email"][required]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'click_element_by_index': {'index': 14}, 'interacted_element': DOMHistoryElement(tag_name='button', xpath='html/body/section/div/div/div[3]/div/form/button', highlight_index=14, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'button'], attributes={'type': 'submit', 'data-qa': 'signup-button', 'class': 'btn btn-default'}, shadow_root=False, css_selector='html > body > section > div > div > div:nth-of-type(3) > div > form > button.btn.btn-default[type="submit"][data-qa="signup-button"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'click_element_by_index': {'index': 12}, 'interacted_element': DOMHistoryElement(tag_name='input', xpath='html/body/section/div/div/div/div[1]/form/div[1]/div[1]/label/div/span/input', highlight_index=12, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'div', 'div', 'label', 'div', 'span', 'input'], attributes={'type': 'radio', 'name': 'title', 'id': 'id_gender1', 'value': 'Mr'}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > div:nth-of-type(1) > div:nth-of-type(1) > label > div > span > input[type="radio"][name="title"][id="id_gender1"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'input_text': {'index': 20, 'text': 'Test!@#123'}, 'interacted_element': DOMHistoryElement(tag_name='input', xpath='html/body/section/div/div/div/div[1]/form/div[4]/input', highlight_index=20, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'div', 'input'], attributes={'type': 'password', 'class': 'form-control', 'data-qa': 'password', 'id': 'password', 'required': '', 'name': 'password', 'value': ''}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > div:nth-of-type(4) > input.form-control[type="password"][data-qa="password"][id="password"][required][name="password"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'select_dropdown_option': {'index': 22, 'text': '1'}, 'interacted_element': DOMHistoryElement(tag_name='select', xpath='html/body/section/div/div/div/div[1]/form/div[5]/div/div[1]/div/select', highlight_index=22, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'div', 'div', 'div', 'div', 'select'], attributes={'data-qa': 'days', 'id': 'days', 'name': 'days', 'class': 'form-control'}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > div:nth-of-type(5) > div > div:nth-of-type(1) > div > select.form-control[data-qa="days"][id="days"][name="days"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'select_dropdown_option': {'index': 23, 'text': 'January'}, 'interacted_element': DOMHistoryElement(tag_name='select', xpath='html/body/section/div/div/div/div[1]/form/div[5]/div/div[2]/div/select', highlight_index=23, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'div', 'div', 'div', 'div', 'select'], attributes={'data-qa': 'months', 'id': 'months', 'name': 'months', 'class': 'form-control'}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > div:nth-of-type(5) > div > div:nth-of-type(2) > div > select.form-control[data-qa="months"][id="months"][name="months"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'select_dropdown_option': {'index': 24, 'text': '2000'}, 'interacted_element': DOMHistoryElement(tag_name='select', xpath='html/body/section/div/div/div/div[1]/form/div[5]/div/div[3]/div/select', highlight_index=24, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'div', 'div', 'div', 'div', 'select'], attributes={'data-qa': 'years', 'id': 'years', 'name': 'years', 'class': 'form-control'}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > div:nth-of-type(5) > div > div:nth-of-type(3) > div > select.form-control[data-qa="years"][id="years"][name="years"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'click_element_by_index': {'index': 25}, 'interacted_element': DOMHistoryElement(tag_name='input', xpath='html/body/section/div/div/div/div[1]/form/div[6]/div/span/input', highlight_index=25, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'div', 'div', 'span', 'input'], attributes={'type': 'checkbox', 'name': 'newsletter', 'id': 'newsletter', 'value': '1'}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > div:nth-of-type(6) > div > span > input[type="checkbox"][name="newsletter"][id="newsletter"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'click_element_by_index': {'index': 27}, 'interacted_element': DOMHistoryElement(tag_name='input', xpath='html/body/section/div/div/div/div[1]/form/div[7]/div/span/input', highlight_index=27, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'div', 'div', 'span', 'input'], attributes={'type': 'checkbox', 'name': 'optin', 'id': 'optin', 'value': '1'}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > div:nth-of-type(7) > div > span > input[type="checkbox"][name="optin"][id="optin"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'scroll_down': {'amount': 500}, 'interacted_element': None}, {'input_text': {'index': 11, 'text': 'Gaurav'}, 'interacted_element': DOMHistoryElement(tag_name='input', xpath='html/body/section/div/div/div/div[1]/form/p[1]/input', highlight_index=11, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'p', 'input'], attributes={'type': 'text', 'data-qa': 'first_name', 'class': 'form-control', 'id': 'first_name', 'name': 'first_name', 'required': '', 'value': ''}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > p:nth-of-type(1) > input.form-control[type="text"][data-qa="first_name"][id="first_name"][name="first_name"][required]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'input_text': {'index': 13, 'text': 'Singh'}, 'interacted_element': DOMHistoryElement(tag_name='input', xpath='html/body/section/div/div/div/div[1]/form/p[2]/input', highlight_index=13, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'p', 'input'], attributes={'type': 'text', 'data-qa': 'last_name', 'class': 'form-control', 'id': 'last_name', 'name': 'last_name', 'required': '', 'value': ''}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > p:nth-of-type(2) > input.form-control[type="text"][data-qa="last_name"][id="last_name"][name="last_name"][required]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'input_text': {'index': 15, 'text': 'Example Inc'}, 'interacted_element': DOMHistoryElement(tag_name='input', xpath='html/body/section/div/div/div/div[1]/form/p[3]/input', highlight_index=15, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'p', 'input'], attributes={'type': 'text', 'data-qa': 'company', 'class': 'form-control', 'id': 'company', 'name': 'company', 'value': ''}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > p:nth-of-type(3) > input.form-control[type="text"][data-qa="company"][id="company"][name="company"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'input_text': {'index': 17, 'text': '123 Main St'}, 'interacted_element': DOMHistoryElement(tag_name='input', xpath='html/body/section/div/div/div/div[1]/form/p[4]/input', highlight_index=17, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'p', 'input'], attributes={'type': 'text', 'data-qa': 'address', 'class': 'form-control', 'required': '', 'name': 'address1', 'id': 'address1', 'value': ''}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > p:nth-of-type(4) > input.form-control[type="text"][data-qa="address"][required][name="address1"][id="address1"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'input_text': {'index': 19, 'text': 'Apt 4B'}, 'interacted_element': DOMHistoryElement(tag_name='input', xpath='html/body/section/div/div/div/div[1]/form/p[5]/input', highlight_index=19, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'p', 'input'], attributes={'type': 'text', 'data-qa': 'address2', 'class': 'form-control', 'name': 'address2', 'id': 'address2', 'value': ''}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > p:nth-of-type(5) > input.form-control[type="text"][data-qa="address2"][name="address2"][id="address2"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'select_dropdown_option': {'index': 21, 'text': 'Canada'}, 'interacted_element': None}, {'input_text': {'index': 23, 'text': 'Ontario'}, 'interacted_element': None}, {'input_text': {'index': 25, 'text': 'M1M 1M1'}, 'interacted_element': None}, {'input_text': {'index': 27, 'text': '1234567890'}, 'interacted_element': None}, {'select_dropdown_option': {'index': 21, 'text': 'Canada'}, 'interacted_element': None}, {'scroll_down': {'amount': 500}, 'interacted_element': None}, {'select_dropdown_option': {'index': 21, 'text': 'Canada'}, 'interacted_element': None}, {'input_text': {'index': 23, 'text': 'Ontario'}, 'interacted_element': None}, {'input_text': {'index': 25, 'text': 'M1M 1M1'}, 'interacted_element': None}, {'input_text': {'index': 27, 'text': '1234567890'}, 'interacted_element': None}, {'select_dropdown_option': {'index': 6, 'text': 'Canada'}, 'interacted_element': DOMHistoryElement(tag_name='select', xpath='html/body/section/div/div/div/div[1]/form/p[6]/select', highlight_index=6, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'p', 'select'], attributes={'data-qa': 'country', 'id': 'country', 'name': 'country', 'required': '', 'class': 'form-control'}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > p:nth-of-type(6) > select.form-control[data-qa="country"][id="country"][name="country"][required]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'input_text': {'index': 8, 'text': 'Ontario'}, 'interacted_element': DOMHistoryElement(tag_name='input', xpath='html/body/section/div/div/div/div[1]/form/p[7]/input', highlight_index=8, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'p', 'input'], attributes={'type': 'text', 'data-qa': 'state', 'class': 'form-control', 'required': '', 'name': 'state', 'id': 'state', 'value': ''}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > p:nth-of-type(7) > input.form-control[type="text"][data-qa="state"][required][name="state"][id="state"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'input_text': {'index': 10, 'text': 'Toronto'}, 'interacted_element': DOMHistoryElement(tag_name='input', xpath='html/body/section/div/div/div/div[1]/form/p[8]/input', highlight_index=10, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'p', 'input'], attributes={'type': 'text', 'data-qa': 'city', 'class': 'form-control', 'required': '', 'name': 'city', 'id': 'city', 'value': ''}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > p:nth-of-type(8) > input.form-control[type="text"][data-qa="city"][required][name="city"][id="city"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'input_text': {'index': 12, 'text': 'M1M 1M1'}, 'interacted_element': DOMHistoryElement(tag_name='input', xpath='html/body/section/div/div/div/div[1]/form/p[9]/input', highlight_index=12, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'p', 'input'], attributes={'type': 'text', 'data-qa': 'zipcode', 'class': 'form-control', 'required': '', 'name': 'zipcode', 'id': 'zipcode', 'value': ''}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > p:nth-of-type(9) > input.form-control[type="text"][data-qa="zipcode"][required][name="zipcode"][id="zipcode"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'input_text': {'index': 14, 'text': '1234567890'}, 'interacted_element': DOMHistoryElement(tag_name='input', xpath='html/body/section/div/div/div/div[1]/form/p[10]/input', highlight_index=14, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'p', 'input'], attributes={'type': 'text', 'data-qa': 'mobile_number', 'class': 'form-control', 'required': '', 'name': 'mobile_number', 'id': 'mobile_number', 'value': ''}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > p:nth-of-type(10) > input.form-control[type="text"][data-qa="mobile_number"][required][name="mobile_number"][id="mobile_number"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'click_element_by_index': {'index': 15}, 'interacted_element': DOMHistoryElement(tag_name='button', xpath='html/body/section/div/div/div/div[1]/form/button', highlight_index=15, entire_parent_branch_path=['section', 'div', 'div', 'div', 'div', 'form', 'button'], attributes={'type': 'submit', 'data-qa': 'create-account', 'class': 'btn btn-default'}, shadow_root=False, css_selector='html > body > section > div > div > div > div:nth-of-type(1) > form > button.btn.btn-default[type="submit"][data-qa="create-account"]', page_coordinates=None, viewport_coordinates=None, viewport_info=None)}, {'done': {'text': 'I have successfully created an account with the name Gaurav Singh and a random email address. The password was set to Test!@#123. The Account Created! message was shown.', 'success': True}, 'interacted_element': None}])

Process finished with exit code 0

你可能感兴趣的:(测试,AI自动化测试)