首页 > 解决方案 > Jenkins 在作业类型上使用组件相同的站点执行行为

问题描述

我正在为 QA 任务开发解决方案。在此项目任务中,需要将“相同站点”参数设置为“无”。但它会在执行测试时阻止测试的正确运行。并且根据与客户端的策略,无法断开此参数。因此,我们应用了一系列没有结果的解决方案(您可以在“来源”部分看到它们)

语言:Python2.7 操作系统:Ubuntu服务器

建筑学:

架构:x86_64 CPU 操作模式:32 位、64 位字节顺序:Little Endian CPU:12 在线 CPU 列表:每核 0-11 个线程:1 核每个插槽:2 个插槽:6 个 NUMA 节点:1 个供应商 ID:GenuineIntel CPU 系列:6 个型号:85 型号名称:Intel(R) Xeon(R) Gold 6248R CPU @ 3.00GHz 步进: 7 CPU MHz:2992.968 BogoMIPS:5985.93 Hypervisor 供应商:VMware 虚拟化类型:完整 L1d 缓存:32K L1i 缓存:32K L2 缓存:1024K L3 缓存:36608K NUMA 节点0 CPU:0-11

使用www.DeepL.com/Translator翻译(免费版)Jenkins 2.284 来源:

如何在 Java Selenium 中禁用 Chrome 实验选项 same-site-by-default-cookies? https://web.dev/samesite-cookies-explained/ 如何在 python selenium 中设置 Chrome 实验选项 same-site-by-default-cookie https://www.softwaretestinghelp.com/how-to-use-different- browsers-drivers-for-your-selenium-script/#1_HTML_Unit_Driver https://www.chromestatus.com/feature/5088147346030592 https://pypi.org/project/samesite-compat-check/ 测试集:链接本地远程测试:chrome safary safary firefox Opera 响应。
调节过程的线。

import time
import allure
from allure_commons.types import AttachmentType
from selenium import webdriver
from behave.model import Scenario

##############################
AFTER/BEFORE ALL

##############################

def before_all(context):
# LOCAL LAUNCH // REMOTE LAUNCH FOR JENKINS

#Args:
#    context:

try:
    option = webdriver.ChromeOptions()
    option.add_experimental_option('w3c', False)
    option.add_argument("--incognito")
    option.add_argument("--start-maximized")
    context.browser = webdriver.Chrome(chrome_options=option)
except Exception:

    context.browser = webdriver.Remote(
        command_executor="<http://10.210.117.105:4444/wd/hub",>
        desired_capabilities=webdriver.DesiredCapabilities.HTMLUNIT,
        # desired_capabilities={
        #     "browserName": "chrome",
        #     'javascriptEnabled': True,
        #     "args": "start-maximized",
        #     "trueLogScreenshotMode": "always"}
         )
    context.browser.set_window_size(1440, 960)
    # A partir de aquí.
    context.browser.add_cookie({"name": "acces", 'sameSite': 'none', 'secure': True})

结果:ON local 仅达到 80% 的测试执行成功率。在服务器上 100% 的测试失败。用 Chrome、Firefox、Opera 测试:没有成功。在查看了组成项目的不同技术的文档后,没有找到解决方案:Behave

Gerkhin

Selenium

Python

Jenkins

Nexus

SonarQube

错误信息:无法访问网站(但同时您可以打开浏览器并查看该网站。

标签: pythonjenkins

解决方案


推荐阅读