selenide 在测试过程中需要设置许多的默认值,方便在测试过程中进行和很好的使用。下面我们在selenide中的api引用过来看看!

static Configuration.AssertionMode  assertionMode

Assertion mode - STRICT or SOFT Asserts Default value: STRICT

static java.lang.String baseUrl

Base url for open() function calls Can be configured either programmatically or by system property "-Dselenide.baseUrl=http://myhost".

static java.lang.String browser

Which browser to use.

static java.lang.String browserBinary

Sets the path to browser executable.

static org.openqa.selenium.remote.DesiredCapabilities browserCapabilities

Browser capabilities.

static java.lang.String browserPosition

The browser window position on screen.

static java.lang.String browserSize

The browser window size.

static java.lang.String browserVersion

Which browser version to use (for Internet Explorer).

static boolean captureJavascriptErrors

Defines if Selenide tries to capture JS errors Can be configured either programmatically or by system property "-Dselenide.captureJavascriptErrors=false".

static java.lang.String chromeSwitches

Deprecated.

this options allowed only a single switch. Please use instead more generic -Dchromeoptions.args=

or use -Dchromeoptions.prefs=

Value of "chrome.switches" parameter (in case of using Chrome driver). Can be configured either programmatically or by system property, i.e. "-Dselenide.chrome.switches=--disable-popup-blocking". Default value: none

static boolean clickViaJs

ATTENTION! Automatic WebDriver waiting after click isn't working in case of using this feature.

static long closeBrowserTimeoutMs

Timeout (in milliseconds) for closing/killing browser.

static long collectionsPollingInterval

Interval in milliseconds, when checking if a new collection elements appeared Can be configured either programmatically or by system property "-Dselenide.collectionsPollingInterval=150" Default value: 200 (milliseconds)

static long collectionsTimeout

Timeout in milliseconds for a collection to get completely loaded Conditions will be checked at this point at latest, even if they are still loading Can be configured either programmatically or by system property "-Dselenide.collectionsTimeout=10000" Default value: 6000 (milliseconds)

static boolean dismissModalDialogs

Mock "alert" and "confirm" javascript dialogs.

static boolean driverManagerEnabled

Controls Selenide and WebDriverManager integration.

static boolean fastSetValue

If set to true, sets value by javascript instead of using Selenium built-in "sendKey" function (that is quite slow because it sends every character separately).

static Configuration.FileDownloadMode fileDownload

Defines if files are downloaded via direct HTTP or vie selenide emebedded proxy server Can be configured either programmatically or by system property "-Dselenide.fileDownload=PROXY" Default: HTTPGET

static boolean headless

Enables the ability to run the browser in headless mode.

static boolean holdBrowserOpen

If holdBrowserOpen is true, browser window stays open after running tests.

static long openBrowserTimeoutMs

Timeout (in milliseconds) for opening (creating) a browser (webdriver).

static java.lang.String pageLoadStrategy

Should webdriver wait until page is completely loaded.

static long pollingInterval

Interval in milliseconds, when checking if a single element is appeared Can be configured either programmatically or by system property "-Dselenide.pollingInterval=50" Default value: 100 (milliseconds)

static java.lang.String remote

URL of remote web driver (in case of using Selenium Grid).

static boolean reopenBrowserOnFail

Should Selenide re-spawn browser if it's disappeared (hangs, broken, unexpectedly closed).

static java.lang.String reportsFolder

Folder to store screenshots to.

static java.lang.String reportsUrl

Optional: URL of CI server where reports are published to.

static boolean savePageSource

Defines if Selenide saves page source on failing tests.

static boolean screenshots

Defines if Selenide takes screenshots on failing tests.

static Configuration.SelectorMode selectorMode

Choose how Selenide should retrieve web elements: using default CSS or Sizzle (CSS3)

static boolean setValueChangeEvent 

If set to true, 'setValue' and 'val' methods of SelenideElement trigger changeEvent after main manipulations.

static boolean startMaximized

The browser window is maximized when started.

static long timeout

Timeout in milliseconds to fail the test, if conditions still not met Can be configured either programmatically or by system property "-Dselenide.timeout=10000" Default value: 4000 (milliseconds)

static boolean versatileSetValue

If set to true, 'setValue' and 'val' methods of SelenideElement can work as 'selectOptionByValue', 'selectRadio' depending on the real control type, defined by element's tag.

这个类里的方法非常有用。我抽几个重点的描述一下:

baseUrl

:统一设置网站的根路径,这个可以让我们少写很多的路径,只需要写根路径后面的内容

browser

:选择那个浏览器做访问的浏览器,这个默认情况下是firefox

browserCapabilities

:可以任意定义访问浏览器的能力

browserSize

:定义控制浏览器的大小,默认情况下是窗口最大化

Configuration.browserSize="1024x768";

pageLoadStrategy

:定义浏览器的加载策略。默认为”normal”正常另外还有 "none" and "eager" 不常用。一般设置为normal就好

screenshots

:设置截图规则。默认是fail时自动截图

这些在全局自动化UI测试过程中非常有用。我们经常用到。

具体更详情的内容请移步官网javadoc文档:http://selenide.org/javadoc.html

大家有什么问题或交流的内容可直接加我微信下方二维码,或加群 452132028

selenide 自动化UI测试中Configuration全局配置项目的更多相关文章

  1. 一种新的自动化 UI 测试解决方案 Airtest Project

    今天分享一个自动化UI测试工具airtest——一款网易出品的基于图像识别面向游UI测试的工具,也支持原生Android App基于元素识别的UI自动化测试.主要包含了三部分:Airtest IDE. ...

  2. [ionic开源项目教程] - 第5讲 如何在项目中使用全局配置

    第5讲 如何在项目中使用全局配置? Q:ionic开发,说纯粹一点,用的就是html+css+js,那么无疑跟web开发的方式是类似的.在这里给大家分享一个小技巧,如何在项目中使用全局配置? A:我的 ...

  3. Swagger ui测试中的验证 apikey

    Swagger ui测试中的验证 apikey 我们使用swagger 用来呈现webapi的接口,除了可以看到接口的说明和参数说明,还可以进行测试.但是我们的接口通常是有验证的,不是随便就能调用的, ...

  4. angular单元测试与自动化UI测试实践

    关于本文:介绍通过karma与jsmine框架对angular开发的应用程序进行单元与E2E测试. angular单元测试与集成测试实践 先决条件 创建项目 webstorm中创建空白web项目 创建 ...

  5. Appium 在 Android UI 测试中的应用

    原文地址:https://blog.coding.net/blog/Appium-Android-UI Android 测试工具与 Appium 简介 Appium 是一个 C/S 架构的,支持 An ...

  6. Chrome-headless 模式,没有UI界面的自动化UI测试

    如果在本机执行UI自动化脚本,打开的浏览器总是会不同程度的影响你做别的事情,那么我们可以采用 无界面运行我们的UI自动化,这种模式下运行脚本并不会真正地打开浏览器,整个过程都是在后台执行的.爽歪歪. ...

  7. 【终极答案】搭建selenium3.11 +Firefox+python3.6自动化UI测试环境踩的坑

    1 运行之后,出现如下报错 Selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs ...

  8. 使用uiautomator做UI测试

    转载~~~~~~~~~~~~~~~~~~~~~~~~ 若有侵权,请及时联系本博主,博主将第一时间撤销 在Android 4.1发布的时候包含了一种新的测试工具–uiautomator,uiautoma ...

  9. [转载]使用uiautomator做UI测试

    这个只是单纯的mark一下.还没有认真去研究.鉴于最近也不会做手机的自动化测试,所以留作以后参考吧. 转自: http://blog.chengyunfeng.com/?p=504 在Android ...

随机推荐

  1. 【题解】洛谷P2607【ZJOI2008】骑士

    洛谷P2607:https://www.luogu.org/problemnew/show/P2607 一道毒瘤的环基树问题 第一次做环基树的题目 刚看题目的时候觉得不就是跟没有上司的舞会一样嘛 然后 ...

  2. 旧文备份:FFTW介绍

    1. FFTW介绍 FFTW由麻省理工学院计算机科学实验室超级计算技术组开发的一套离散傅立叶变换(DFT)的计算库,开源.高效和标准C语言编写的代码使其得到了非常广泛的应用,Intel的数学库和Sci ...

  3. mssql数据库迁移到mysql

    使用mysql migration toolkit工具来进行迁移.(需要安装jdk6 java的安装包) 发现数据量大的表却没能迁过来.软件使用比较容易,配置下源数据库信息,和目标数据库信息就可以进行 ...

  4. 时间戳转化为时间&&截取时间的年月日

    时间戳转化为正常的时间格式 function formatDate(date, fmt) { if (/(y+)/.test(fmt)) { // 在这里 date.getFullYear() + ' ...

  5. SpringBoot非官方教程 | 第二十二篇: 创建含有多module的springboot工程

    转载请标明出处: 原文首发于:https://www.fangzhipeng.com/springboot/2017/07/11/springbot22-modules/ 本文出自方志朋的博客 这篇文 ...

  6. OGG抽取进程异常问题排查一例

    1.问题现象抽取进程常常running,但是没有新产生trail文件,lag比较大 GGSCI (xxxdb) > info all Program Status Group Lag at Ch ...

  7. 纯 HTML5 APP与原生APP的差距在哪?

    纯 HTML5 APP与原生APP的差距在哪? 写过一些纯H5的APP,虽然开发起来的确很快很舒服,但和原生比起来纯H5APP还是有很多问题,主要聚集在以下几个方面: 1.动画 动画有很多种,比如侧边 ...

  8. sql语句中#{}和${}的区别

    #---将传入的数据都当成一个字符串,会对自动传入的数据加一个双引号.如:order by #user_id#,如果传入的值是111,那么解析成sql时的值为order by “111”, 如果传入的 ...

  9. WinForm webbrowser控件的使用

    webbrowser是一个比较实用的工具,主要用于在winform窗体中嵌入浏览器,达到winform与webform互操作的目的. 先上一个demo,看一下能实现什么效果. private void ...

  10. 讯为iTop4412嵌入式开发板学习之-------前言

    一.linux 工作的分类以及培养时间 Linux 作为一个庞大的体系,有很多相关的研究领域,总结起来大致有五个方向: 1.服务器维护:需要了解 Linux 服务,熟练使用 Shell,了解网络配置. ...