下記のサイトのようにワードプレスに自動で入力してみたいと思ったのですが、タイトルは入るのですが、本文には入りませんでした。
一年以上前の投稿なので何か仕様がかわっていたりしているのでしょうか?
https://qiita.com/kkdmgs110/items/f0e3c17a64736d18fbc5
python
1title = "Test" 2content = "test post" 3driver.find_element_by_css_selector("#title").send_keys(title) 4driver.find_element_by_css_selector("#content_ifr").send_keys(Content) 5driver.find_element_by_css_selector("#save-post").click 6time.sleep(5) #waiting for post
よろしくお願いいたします。
<html lang="ja" style="overflow-y: hidden;"><head><style id="mceDefaultStyles" type="text/css">.mce-content-body div.mce-resizehandle {position: absolute;border: 1px solid black;box-sizing: content-box;background: #FFF;width: 7px;height: 7px;z-index: 10000}.mce-content-body .mce-resizehandle:hover {background: #000}.mce-content-body img[data-mce-selected],.mce-content-body hr[data-mce-selected] {outline: 1px solid black;resize: none}.mce-content-body .mce-clonedresizable {position: absolute;outline: 1px dashed black;opacity: .5;filter: alpha(opacity=50);z-index: 10000}.mce-content-body .mce-resize-helper {background: #555;background: rgba(0,0,0,0.75);border-radius: 3px;border: 1px;color: white;display: none;font-family: sans-serif;font-size: 12px;white-space: nowrap;line-height: 14px;margin: 5px 10px;padding: 5px;position: absolute;z-index: 10001} .mce-visual-caret {position: absolute;background-color: black;background-color: currentcolor;}.mce-visual-caret-hidden {display: none;}*[data-mce-caret] {position: absolute;left: -1000px;right: auto;top: 0;margin: 0;padding: 0;} .mce-content-body .mce-offscreen-selection {position: absolute;left: -9999999999px;max-width: 1000000px;}.mce-content-body *[contentEditable=false] {cursor: default;}.mce-content-body *[contentEditable=true] {cursor: text;} </style><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel="stylesheet" type="text/css" id="u0" href="https://llcmujin.com/wp-includes/js/tinymce/skins/lightgray/content.min.css?wp-mce-4940-20190515"><link rel="stylesheet" type="text/css" id="u1" href="https://llcmujin.com/wp-includes/css/dashicons.min.css?ver=5.2.3&wp-mce-4940-20190515"><link rel="stylesheet" type="text/css" id="u2" href="https://llcmujin.com/wp-includes/js/tinymce/skins/wordpress/wp-content.css?ver=5.2.3&wp-mce-4940-20190515"><link rel="stylesheet" type="text/css" id="u3" href="https://llcmujin.com/wp-content/plugins/search-everything/static/css/se-styles.css?wp-mce-4940-20190515"></head><body id="tinymce" class="mce-content-body content post-type-post post-status-draft post-format-standard page-template-default locale-ja mceContentBody webkit wp-editor wp-autoresize html5-captions" data-id="content" contenteditable="true" style="overflow-y: hidden;"><p><br data-mce-bogus="1"></p></body></html>html
1<iframe id="content_ifr" frameborder="0" allowtransparency="true" title="リッチテキストエリア。Control-Option-H キーでヘルプを表示できます。" style="width: 100%; height: 300px; display: block;"></iframe>
コードに書くと横長になってしまったので直接書きました。
html
1<html lang="ja" style="overflow-y: hidden;"><head><style id="mceDefaultStyles" type="text/css">.mce-content-body div.mce-resizehandle {position: absolute;border: 1px solid black;box-sizing: content-box;background: #FFF;width: 7px;height: 7px;z-index: 10000}.mce-content-body .mce-resizehandle:hover {background: #000}.mce-content-body img[data-mce-selected],.mce-content-body hr[data-mce-selected] {outline: 1px solid black;resize: none}.mce-content-body .mce-clonedresizable {position: absolute;outline: 1px dashed black;opacity: .5;filter: alpha(opacity=50);z-index: 10000}.mce-content-body .mce-resize-helper {background: #555;background: rgba(0,0,0,0.75);border-radius: 3px;border: 1px;color: white;display: none;font-family: sans-serif;font-size: 12px;white-space: nowrap;line-height: 14px;margin: 5px 10px;padding: 5px;position: absolute;z-index: 10001} 2.mce-visual-caret {position: absolute;background-color: black;background-color: currentcolor;}.mce-visual-caret-hidden {display: none;}*[data-mce-caret] {position: absolute;left: -1000px;right: auto;top: 0;margin: 0;padding: 0;} 3.mce-content-body .mce-offscreen-selection {position: absolute;left: -9999999999px;max-width: 1000000px;}.mce-content-body *[contentEditable=false] {cursor: default;}.mce-content-body *[contentEditable=true] {cursor: text;} 4</style><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel="stylesheet" type="text/css" id="u0" href="https://llcmujin.com/wp-includes/js/tinymce/skins/lightgray/content.min.css?wp-mce-4940-20190515"><link rel="stylesheet" type="text/css" id="u1" href="https://llcmujin.com/wp-includes/css/dashicons.min.css?ver=5.2.3&wp-mce-4940-20190515"><link rel="stylesheet" type="text/css" id="u2" href="https://llcmujin.com/wp-includes/js/tinymce/skins/wordpress/wp-content.css?ver=5.2.3&wp-mce-4940-20190515"><link rel="stylesheet" type="text/css" id="u3" href="https://llcmujin.com/wp-content/plugins/search-everything/static/css/se-styles.css?wp-mce-4940-20190515"></head><body id="tinymce" class="mce-content-body content post-type-post post-status-draft post-format-standard page-template-default locale-ja mceContentBody webkit wp-editor wp-autoresize html5-captions" data-id="content" contenteditable="true" style="overflow-y: hidden;"><p><br data-mce-bogus="1"></p></body></html>
html
1<textarea class="wp-editor-area" style="height: 360px; margin-top: 67px;" autocomplete="off" cols="40" name="content" id="content" aria-hidden="false"></textarea>
html
1<button type="button" id="content-html" class="wp-switch-editor switch-html" data-wp-editor-id="content">テキスト</button>
下書きを書く画面のformタグで囲まれた部分のHTMLを全て貼り付けてもらえませんか。
回答ありがとうございます。
formタグで囲まれたHTML部分が凄く長く入りきらなかったので下書きを書く場所のHTMLを載せました。
<iframe id="content_ifr" frameborder="0" allowtransparency="true" title="リッチテキストエリア。Control-Option-H キーでヘルプを表示できます。" style="width: 100%; height: 300px; display: block;"></iframe>
ちなみにselectorも #content_ifr です。
よろしくお願いいたします。
回答2件
あなたの回答
tips
プレビュー