问题
业务流程描述:
登录业务系统-点击应用-点击销售管理-点击商机报送-编辑商机信息并点击报送,在报送的页面获取商机名称和编号信息并用变量接收-再点击应用回到应用页面-点击工作流服务(此时点击完成后会打开一个新的窗口,然后需要再新的窗口中点击流程实例按钮,在这一步就会报错(我在点击前后都获取了所有窗口句柄信息,返回的句柄列表就只有一个相同的句柄,按这种我理解就还是在同一个窗口下,然后我也加了显示等待和强制等待,分别会提示超时和元素不可交互的报错提示)
报错信息
FAILED [100%]报送成功后的商机名称和商机编号分别是:autotestdata011,SJ-24-08-21-E53E82C7
['DF74ABB6CBF5334BAA09740E895D88F7']
['DF74ABB6CBF5334BAA09740E895D88F7']
test_sjbs_uat_env.py:19 (TestSjbs.test_sjbs)
self = <Web.Szc_Ltc_System.test_sjbs_uat_env.TestSjbs object at 0x0000019AC9BDAD30>
test_sjbs_uat_env.py:179:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
..\venv_hjh\lib\site-packages\selenium\webdriver\remote\webelement.py:94: in click
self._execute(Command.CLICK_ELEMENT)
..\venv_hjh\lib\site-packages\selenium\webdriver\remote\webelement.py:395: in _execute
return self._parent.execute(command, params)
..\venv_hjh\lib\site-packages\selenium\webdriver\remote\webdriver.py:354: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x0000019AC9EDE130>
response = {'status': 400, 'value': '{"value":{"error":"element not interactable","message":"element not interactable\\n (Sessio...07FF7BD6EE16F]\\n\\tBaseThreadInitThunk [0x00007FFAD25B7374+20]\\n\\tRtlUserThreadStart [0x00007FFAD459CC91+33]\\n"}}'}
def check_response(self, response: Dict[str, Any]) -> None:
"""Checks that a JSON response from the WebDriver does not have an
error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json
try:
value = json.loads(value_json)
if len(value) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass
exception_class: Type[WebDriverException]
e = ErrorCode()
error_codes = [item for item in dir(e) if not item.startswith("__")]
for error_code in error_codes:
error_info = getattr(ErrorCode, error_code)
if isinstance(error_info, list) and status in error_info:
exception_class = getattr(ExceptionMapping, error_code, WebDriverException)
break
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]
screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]
stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = f"{frame['className']}.{meth}"
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
E (Session info: chrome=127.0.6533.120)
E Stacktrace:
E GetHandleVerifier [0x00007FF7BD77EEA2+31554]
E (No symbol) [0x00007FF7BD6F7ED9]
E (No symbol) [0x00007FF7BD5B8559]
E (No symbol) [0x00007FF7BD6097C2]
E (No symbol) [0x00007FF7BD5FC151]
E (No symbol) [0x00007FF7BD62D02A]
E (No symbol) [0x00007FF7BD5FBA76]
E (No symbol) [0x00007FF7BD62D240]
E (No symbol) [0x00007FF7BD64C977]
E (No symbol) [0x00007FF7BD62CDD3]
E (No symbol) [0x00007FF7BD5FA33B]
E (No symbol) [0x00007FF7BD5FAED1]
E GetHandleVerifier [0x00007FF7BDA88B1D+3217341]
E GetHandleVerifier [0x00007FF7BDAD5AE3+3532675]
E GetHandleVerifier [0x00007FF7BDACB0E0+3489152]
E GetHandleVerifier [0x00007FF7BD82E776+750614]
E (No symbol) [0x00007FF7BD70375F]
E (No symbol) [0x00007FF7BD6FEB14]
E (No symbol) [0x00007FF7BD6FECA2]
E (No symbol) [0x00007FF7BD6EE16F]
E BaseThreadInitThunk [0x00007FFAD25B7374+20]
E RtlUserThreadStart [0x00007FFAD459CC91+33]
..\venv_hjh\lib\site-packages\selenium\webdriver\remote\errorhandler.py:229: ElementNotInteractableException