Selenium     PHP
•       PHP    •    • twitter.com/suzuki
•       PHP   Selenium    •           :-)
•       Web•    •    • Selenium
Selenium-IDE
SeleniumSelenium-IDESelenium-IDE
•
Web
•    •    •
SeleniumWeb
• Selenium • •
•    •    • UI
Selenium-IDE
Selenium-IDE• Selenium-IDE   → •
http://croogo.org/
Croogo         http://twitter.com/fahad19Croogo         http://twitter.com/makies
•    •    • blog    • blog    • blog
Username   PasswordLog In
“You are logged in as Admin”
blogBlog         Slug   BodySubmit
blog“Blog has been saved”
blogSubmit
blog“Blog has been saved”          Blog
blogBlog
blog
Demo• Selenium-IDE •           Blog
TIPS•    •   Blog    2••
•    •    •     <table>    •   HTML
•    •    •           HTML        <a>      <table>    •         HTML
Demo•
ClickClickAndWait
BodyBody       ...
BodyFirebug<iframe id=”NodeBody_ifr”> <html>  <head>  <body id=”tinymce”>
Body• Body • <iframe> •       <body>
Body• type• JavaScript    ...
BodygetEvalJavaScript
Body• Firebugdocument .getElementById(NodeBody_ifr)  .contentWindow    .document     .getElementById(tinymce)      .innerH...
Body
Body• Seleniumthis.page().getDocument() .getElementById(NodeBody_ifr)  .contentWindow    .document     .getElementById(tin...
BodyBody       ...
••   Blog
••    OK   ...•
•   Body•
•   ...•
“You are logged in as Admin”
• assertTextPresent•
blog“Blog has been saved”
blog• verifyTextPresent :• ${blog_title} : store
blog“Blog has been saved”          Blog
blog•   Web• ${blog_title} / ${blog_body}
blog
blog• assertTextNotPresent :
• assertTextPresent• verifyTextPresent •• assertTextNotPresent• verifyTextNotPresent •
• assertChecked •• assertElementPresent •
• assertTitle • <title>※</title>• assertValue • value=”※”
• assertCookieByName •             Cookie• assertMouseSpeed • mousemove
DEMO•
•     link=       <a>   </a>•    • id=     / name=   / css=
• DOM • dom=• XPath • xpath=//input[@value=Submit]
link=
<a href=”/croogo/admin/nodes/edit/27”><a href=”/croogo/admin/nodes/edit/21”><a href=”/croogo/admin/nodes/edit/20”>
ID
ID•    •    •    •   ID
ID•
• user-extentions.js •         JavaScript
ID•    •    •    •   ID
function getIdFromContentTitle(title) {    var id = 0;    var doc   = selenium.page().getDocument();    var form = doc.get...
for (y = 1; y < tr.length; ++y) {        var td   = tr[y].getElementsByTagName(td);        var text = td[2].getElementsByT...
echo
user-extentionsfunction getIdFromContentTitle(title) {    var id = 0;    var   doc     =   selenium.page().getDocument(); ...
user-extentions var doc   =   selenium.page().getDocument();
seleniumthis.page().getDocument()                                documentselenium.page().getDocument()
XPath• //input[@value=”Submit”] • value     Submit   <input>
XPath• Firebug • XPath
XPath• Firebug   HTML
XPath• XPath
XPath•    XPath
XPath•    XPath• //input[@value=”Submit”]    •
XPath• XPath            Firebug • $x(“ XPath “)
XPath•    •
XPath•
Selenium-IDE•            Selenium-RC•
•
PHPfunction testMyTestCase() {    //    blog_title = "              ";    blog_slug = "hellow_hokkaido";    blog_body = " ...
• Selenium-IDE•            →   ...→    • PHP→     •     •
•   :-)
Selenium AES• Selenium Auto Exec Server • http://www.enjoyxstudy.com/selenium/autoexec/
Selenium AES•    •• Subversion    •
• Selenium••    •        :-)
Selenium
•   Selenium    http://wiki.openqa.org/display/SEL/Selenium+0.7+Reference+(Japanese)•   Selenium            XPath JavaScri...
Photograph Credits•    http://www.flickr.com/photos/jonbro/3356460039/•    http://www.flickr.com/photos/elvire-r/2451784799/...
Photograph Credits•    http://www.flickr.com/photos/racatumba/88846892/    http://www.flickr.com/photos/laszlo-photo/2867574...
•
Selenium再入門
Selenium再入門
Selenium再入門
Selenium再入門
Selenium再入門
Selenium再入門
Selenium再入門
Selenium再入門
Upcoming SlideShare
Loading in...5
×

Selenium再入門

2,820

Published on

「Selenium-IDEを知って、すげーと思って、自分の操作 を記録して再生したら、あれ?うまくいかないぞ? でも今は調べている時間がないから、後で時間が あったら使ってみようと思ってそのままになっている人」向けの資料

Published in: Technology, Design
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,820
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Transcript of "Selenium再入門"

  1. 1. Selenium PHP
  2. 2. • PHP • • twitter.com/suzuki
  3. 3. • PHP Selenium • :-)
  4. 4. • Web• • • Selenium
  5. 5. Selenium-IDE
  6. 6. SeleniumSelenium-IDESelenium-IDE
  7. 7.
  8. 8. Web
  9. 9. • • •
  10. 10. SeleniumWeb
  11. 11. • Selenium • •
  12. 12. • • • UI
  13. 13. Selenium-IDE
  14. 14. Selenium-IDE• Selenium-IDE → •
  15. 15. http://croogo.org/
  16. 16. Croogo http://twitter.com/fahad19Croogo http://twitter.com/makies
  17. 17. • • • blog • blog • blog
  18. 18. Username PasswordLog In
  19. 19. “You are logged in as Admin”
  20. 20. blogBlog Slug BodySubmit
  21. 21. blog“Blog has been saved”
  22. 22. blogSubmit
  23. 23. blog“Blog has been saved” Blog
  24. 24. blogBlog
  25. 25. blog
  26. 26. Demo• Selenium-IDE • Blog
  27. 27. TIPS• • Blog 2••
  28. 28. • • • <table> • HTML
  29. 29. • • • HTML <a> <table> • HTML
  30. 30. Demo•
  31. 31. ClickClickAndWait
  32. 32. BodyBody ...
  33. 33. BodyFirebug<iframe id=”NodeBody_ifr”> <html> <head> <body id=”tinymce”>
  34. 34. Body• Body • <iframe> • <body>
  35. 35. Body• type• JavaScript ...
  36. 36. BodygetEvalJavaScript
  37. 37. Body• Firebugdocument .getElementById(NodeBody_ifr) .contentWindow .document .getElementById(tinymce) .innerHTML = ;
  38. 38. Body
  39. 39. Body• Seleniumthis.page().getDocument() .getElementById(NodeBody_ifr) .contentWindow .document .getElementById(tinymce) .innerHTML = ;
  40. 40. BodyBody ...
  41. 41. •• Blog
  42. 42. •• OK ...•
  43. 43. • Body•
  44. 44. • ...•
  45. 45. “You are logged in as Admin”
  46. 46. • assertTextPresent•
  47. 47. blog“Blog has been saved”
  48. 48. blog• verifyTextPresent :• ${blog_title} : store
  49. 49. blog“Blog has been saved” Blog
  50. 50. blog• Web• ${blog_title} / ${blog_body}
  51. 51. blog
  52. 52. blog• assertTextNotPresent :
  53. 53. • assertTextPresent• verifyTextPresent •• assertTextNotPresent• verifyTextNotPresent •
  54. 54. • assertChecked •• assertElementPresent •
  55. 55. • assertTitle • <title>※</title>• assertValue • value=”※”
  56. 56. • assertCookieByName • Cookie• assertMouseSpeed • mousemove
  57. 57. DEMO•
  58. 58. • link= <a> </a>• • id= / name= / css=
  59. 59. • DOM • dom=• XPath • xpath=//input[@value=Submit]
  60. 60. link=
  61. 61. <a href=”/croogo/admin/nodes/edit/27”><a href=”/croogo/admin/nodes/edit/21”><a href=”/croogo/admin/nodes/edit/20”>
  62. 62. ID
  63. 63. ID• • • • ID
  64. 64. ID•
  65. 65. • user-extentions.js • JavaScript
  66. 66. ID• • • • ID
  67. 67. function getIdFromContentTitle(title) { var id = 0; var doc = selenium.page().getDocument(); var form = doc.getElementById(NodeAddForm); var table = form.getElementsByTagName(table); var tbody = table[0].getElementsByTagName(tbody); var tr = tbody[0].getElementsByTagName(tr);
  68. 68. for (y = 1; y < tr.length; ++y) { var td = tr[y].getElementsByTagName(td); var text = td[2].getElementsByTagName(a)[0].innerHTML; if (text == title) { id = td[1].innerHTML; break; } } return id;}
  69. 69. echo
  70. 70. user-extentionsfunction getIdFromContentTitle(title) { var id = 0; var doc = selenium.page().getDocument(); var form = doc.getElementById(NodeAddForm); var table = form.getElementsByTagName(table); var tbody = table[0].getElementsByTagName(tbody); var tr = tbody[0].getElementsByTagName(tr);
  71. 71. user-extentions var doc = selenium.page().getDocument();
  72. 72. seleniumthis.page().getDocument() documentselenium.page().getDocument()
  73. 73. XPath• //input[@value=”Submit”] • value Submit <input>
  74. 74. XPath• Firebug • XPath
  75. 75. XPath• Firebug HTML
  76. 76. XPath• XPath
  77. 77. XPath• XPath
  78. 78. XPath• XPath• //input[@value=”Submit”] •
  79. 79. XPath• XPath Firebug • $x(“ XPath “)
  80. 80. XPath• •
  81. 81. XPath•
  82. 82. Selenium-IDE• Selenium-RC•
  83. 83.
  84. 84. PHPfunction testMyTestCase() { // blog_title = " "; blog_slug = "hellow_hokkaido"; blog_body = " ";}
  85. 85. • Selenium-IDE• → ...→ • PHP→ • •
  86. 86. • :-)
  87. 87. Selenium AES• Selenium Auto Exec Server • http://www.enjoyxstudy.com/selenium/autoexec/
  88. 88. Selenium AES• •• Subversion •
  89. 89. • Selenium•• • :-)
  90. 90. Selenium
  91. 91. • Selenium http://wiki.openqa.org/display/SEL/Selenium+0.7+Reference+(Japanese)• Selenium XPath JavaScript http://d.hatena.ne.jp/language_and_engineering/20090818•
  92. 92. Photograph Credits• http://www.flickr.com/photos/jonbro/3356460039/• http://www.flickr.com/photos/elvire-r/2451784799/• http://www.flickr.com/photos/citycaucus/4260121599/
  93. 93. Photograph Credits• http://www.flickr.com/photos/racatumba/88846892/ http://www.flickr.com/photos/laszlo-photo/286757494/• JEDI http://www.flickr.com/photos/ggunter/539625103/
  94. 94.

×