项目作者: stasha

项目描述 :
Write selenium tests using XML (includes Page Object pattern)
高级语言: Java
项目地址: git://github.com/stasha/selenx.git
创建时间: 2018-12-30T16:23:52Z
项目社区:https://github.com/stasha/selenx

开源协议:

下载


SelenX

Write selenium tests using XML

Examples

Layout example

  1. <layouts>
  2. <layout id="siteLayout">
  3. <po id="footer" css="#footer">
  4. <el id="cookiePolicy" css="a['/cookie/policy']" ></el>
  5. <el id="privacy" css="a['/privacy']" ></el>
  6. <el id="terms" css="a['/terms']" ></el>
  7. </po>
  8. </layout>
  9. <layout id="notLoggedInLayout" extends="siteLayout">
  10. <po id="header" css="#header">
  11. <el id="logo" css="a" ></el>
  12. <el id="search" css="name['query']" ></el>
  13. <el id="home" css="ul a[href='/']" ></el>
  14. <el id="login" css="ul a[href='/login']" ></el>
  15. <el id="createAccount" css="ul a[href='/create/account']" ></el>
  16. </po>
  17. </layout>
  18. <layout id="loggedInLayout" extends="siteLayout">
  19. <po id="header" css="#header">
  20. <el id="profile" css="ul a[href='/my/profile']" ></el>
  21. <el id="logout" css="ul a[href='/logout']" ></el>
  22. </po>
  23. </layout>
  24. </layouts>

Page example

  1. <pages>
  2. <page id="homePage" layout="notLoggedInLayout">
  3. <po id="content">
  4. <el id="forgotPassword" css="a[href='/forgot/password']" ></el>
  5. <po id="login" css="#login">
  6. <el id="email" css="[name='email']" ></el>
  7. <el id="password" css="[name='password']" ></el>
  8. <el id="rememberme" css="[name='rememberme']" ></el>
  9. <el id="submit" css="[type='submit']" ></el>
  10. </po>
  11. <po id="register" css="#register">
  12. <el id="email" css="[name='email']" ></el>
  13. <el id="password" css="[name='password']" ></el>
  14. <el id="reTypePassword" css="[name='reTypePassword']" ></el>
  15. <el id="agreeWithTerms" css="[name='agreeWithTerms']" ></el>
  16. <el id="submit" css="[type='submit']" ></el>
  17. </po>
  18. </po>
  19. </page>
  20. <page id="logedInHomePage" layout="loggedInLayout">
  21. </page>
  22. </pages>

Test templates example

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <templates>
  3. <template id="loginTemplate">
  4. <type el="login email" value="test53@stasha.info" ></type>
  5. <type el="login password" value="password" ></type>
  6. <select el="login rememberme" value="false" ></select>
  7. <mouse el="login submit" ></mouse>
  8. <assert type="text" css="title">Admastic - Latest ads</assert>
  9. </template>
  10. </templates>

Site example

  1. <site baseUri="http://localhost:8080/">
  2. <import file="core/layout.xml" ></import>
  3. <import file="pages/home.xml" ></import>
  4. <import file="core/templates.xml" ></import>
  5. </site>

Test examples

  1. <tests>
  2. <test id="loginTest">
  3. <navigate url="/" return="homePage" ></navigate>
  4. <mouse type="click" el="header home" ></mouse>
  5. <assert type="text" css="title">Admastic</assert>
  6. <import template="loginTemplate" ></import>
  7. <wait el="header home" until="isVisible" timeout="200" ></wait>
  8. </test>
  9. <test id="logoutTest">
  10. <navigate url="/" return="logedInHomePage" ></navigate>
  11. <mouse el="header logout" return="homePage" ></mouse>
  12. <assert type="text" css="title">Admastic</assert>
  13. </test>
  14. </tests>