1
1
using OpenQA . Selenium ;
2
+ using OpenQA . Selenium . Support . UI ;
2
3
using System ;
3
4
using System . Threading ;
4
5
@@ -22,11 +23,16 @@ public static CreatePostCommand CreatePost(string title)
22
23
23
24
}
24
25
25
- public static void GoToNewPost ( )
26
+ static void GoToNewPost ( )
26
27
{
27
- var message = Driver . Instance . FindElement ( By . ClassName ( "notice__text" ) ) ;
28
- var newPostLink = Driver . Instance . FindElement ( By . XPath ( "//a[@href='https://ideastechno.wordpress.com/2018/06/22/es/']" ) ) ;
29
- newPostLink . Click ( ) ;
28
+
29
+
30
+ var wait = new WebDriverWait ( Driver . Instance , TimeSpan . FromSeconds ( 6 ) ) ;
31
+ wait . Until ( d => d . SwitchTo ( ) . ActiveElement ( ) . GetAttribute ( "ClassName" ) == "entry-title" ) ;
32
+ Driver . Instance . FindElement ( By . ClassName ( "entry-title" ) ) . Click ( ) ;
33
+
34
+ //var newPostLink = Driver.Instance.FindElement(By.XPath("//a[@href='https://ideastechno.wordpress.com/2018/06/22/es/']"));
35
+ //newPostLink.Click();
30
36
}
31
37
32
38
}
@@ -46,13 +52,27 @@ public CreatePostCommand WithBody(string body)
46
52
return this ;
47
53
}
48
54
55
+ /// <summary>
56
+ ///
57
+ /// </summary>
49
58
public void Publish ( )
50
59
{
51
- Driver . Instance . FindElement ( By . CssSelector ( "textarea-autosize editor-title__input" ) ) . SendKeys ( title ) ;
52
- Driver . Instance . FindElement ( By . CssSelector ( ".mce-content-body p" ) ) . SendKeys ( body ) ;
60
+
61
+ var title1 = Driver . Instance . FindElement ( By . CssSelector ( ".textarea-autosize.editor-title__input" ) ) ;
62
+
63
+ title1 . Click ( ) ;
64
+ title1 . SendKeys ( title ) ;
65
+ var body1 = Driver . Instance . FindElement ( By . Id ( "mceu_1-open" ) ) ;
66
+ body1 . Click ( ) ;
67
+ Driver . Instance . FindElement ( By . Id ( "mceu_58-text" ) ) . Click ( ) ;
68
+
69
+ //Driver.Instance.SwitchTo().Frame(Driver.Instance.FindElement(By.Id("tinymce")));
70
+ //Driver.Instance.FindElement(By.CssSelector("tinymce-1_ifr")).SendKeys(body);
71
+
53
72
Thread . Sleep ( 1000 ) ;
54
73
Driver . Instance . FindElement ( By . ClassName ( "editor-ground-control__publish-button" ) ) . Click ( ) ;
55
- Driver . Instance . FindElement ( By . ClassName ( "editor-confirmation-sidebar__actionbutton" ) ) . Click ( ) ;
74
+ Driver . Instance . FindElement ( By . CssSelector ( ".editor-confirmation-sidebar__action > button:nth-child(1)" ) ) . Click ( ) ;
75
+
56
76
57
77
58
78
}
0 commit comments