SimpleBrowserDotNet / SimpleBrowser.WebDriver

A webdriver for SimpleBrowser
Apache License 2.0
43 stars 16 forks source link

Can,t Set WordPress Post Tags #38

Closed FarhadMohseni closed 6 years ago

FarhadMohseni commented 6 years ago

Im trying to send a Wordpress post by Simple browser, everything works great! but when I get the tags field by id or name and set the value to the field value is set in Browser but when I publish the post my post published without tags. I tried many ways to do this (eg: get element by tag name, name, value, id, set attribute etc.) but the results are the same! the post published without any tags. Thanks for your help!

The Tags field element :

<input data-wp-taxonomy="download_tag" type="text" id="new-tag-download_tag" name="newtag[download_tag]" class="newtag form-input-tip ui-autocomplete-input" size="16" autocomplete="off" aria-describedby="new-tag-download_tag-desc" value="" role="combobox" aria-autocomplete="list" aria-expanded="false" aria-owns="ui-id-1"> My code Like this:

//Ttitle
b.Find("input", FindBy.Id, "title").Value = "TestPost"; //Discreption
var a = b.FindAll("textarea"); foreach (var item in a) { a.Value = "Test"; } //Select Category var c = b.Select(".selectit input[type='checkbox']"); foreach (var item in c) { if (item.XElement.Parent.Value.Contains("Article")) { item.Checked = true; } } //Set Tags (This part is not working) var tin = b.Find("input", FindBy.Id,"new-tag-download_tag"); foreach (var item in tin) { item.Value = "test1,test2,test3"; } b.Find("publish").Click();

kevingy commented 6 years ago

What you have looks like it should work. I would have to look at it to diagnose it more. Is this input tag on a publicly available site?