selenide 自动化UI测试中Configuration全局配置项目

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

 

 

61578-20180713141415691-2097590948.jpg

转载于:https://www.cnblogs.com/davice/p/9318708.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值