Selenide: [Question] How can I set the property in java code?

Created on 7 May 2016  Â·  9Comments  Â·  Source: selenide/selenide

Great tool !
Two questions:
1.As title, How can I get and set the property in java code below ?
timeout - (String) can be changed in runtime
browser (e.g. chrome, ie, firefox)
baseUrl
reportsFolder

  1. How can I set the $ method(find element method) timeout in java code?
question

All 9 comments

For example: Configuration.timeout = 8000;

  1. $(...).waitUntil(visible, 12000)

12000 - custom timout just for that $

Viele Grüße

Alexei Vinogradov

Sent from mobile phone

Am 07.05.2016 um 17:39 schrieb Huangfu chunfeng [email protected]:

Great tool !
Two questions:
1.As title, How can I get and set the property in java code below ?
timeout - (String) can be changed in runtime
browser (e.g. chrome, ie, firefox)
baseUrl
reportsFolder

How can I set the $ method(find element method) timeout in java code?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub

Many thanks for the quick answer, have a good day~~

@vinogradoff Can I set the timeout in the Configuration or somewhere?

Configuration.timeout is a global one for all your tests in the suite. You can reset it any time but the most appropriate is in setup Methods or even as system property from test runner - -Dselenide.timeout=...

Viele Grüße

Alexei Vinogradov

Sent from mobile phone

Am 07.05.2016 um 18:22 schrieb Huangfu chunfeng [email protected]:

@vinogradoff Can I set the timeout in the Configuration or somewhere?

—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

@vinogradoff How can I set the system property? Could you give me an example?

As I see description the in the selenide website.
You can also pass the configuration parameters in as system properties to make use of CI Jobs (e.g. -Dselenide.baseUrl=http://staging-server.com/start)

How can I set or get the system properties in CI job as Jenkins?
I can not find the property in System.getenv(); or System.getProperties();

Jenkins just manages the jobs, how do you run your tests? Maven? Gradle? Pure Java?

Put -D... there

Viele Grüße

Alexei Vinogradov

Sent from mobile phone

Am 07.05.2016 um 18:35 schrieb Huangfu chunfeng [email protected]:

@vinogradoff How can I set the system property? Could you give me an example?

As I see description the in the selenide website.
You can also pass the configuration parameters in as system properties to make use of CI Jobs (e.g. -Dselenide.baseUrl=http://staging-server.com/start)

How can I set or get the system properties in CI job as Jenkins?
I can not find the property in System.getenv(); or System.getProperties();

—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

@vinogradoff I use maven test to trigger the test. So I should enter the command with "mvn test -Dselenide.timeout=8000" ?

@yisake Yes, one option is to write "mvn test -Dselenide.timeout=8000".
Another option is to set system property in pom.xml:

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19.1</version>
        <configuration>
          <systemProperties>
            <property>
              <name>selenide.timeout</name>
              <value>8000</value>
            </property>
          </systemProperties>
        </configuration>
      </plugin>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

apreg picture apreg  Â·  5Comments

kazuki43zoo picture kazuki43zoo  Â·  5Comments

AlexMMelnikov picture AlexMMelnikov  Â·  5Comments

yisake picture yisake  Â·  13Comments

rosolko picture rosolko  Â·  4Comments