Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to the Power Users community on Codidact!

Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.

Post History

66%
+2 −0
Q&A How can I do a one-time data import to DokuWiki to create many pages?

While I was writing the answer, I realized that actually Selenium can be used to do this without any need for Dokuwiki plugins that support your specific use case. Selenium is an automated Chrome, ...

posted 9mo ago by matthewsnyder‭  ·  edited 9mo ago by matthewsnyder‭

Answer
#3: Post edited by user avatar matthewsnyder‭ · 2024-02-06T20:59:36Z (9 months ago)
  • While I was writing the answer, I realized that actually [Selenium](https://www.selenium.dev/) can be used to do this without any need for Dokuwiki plugins that support your specific use case. Selenium is an automated Chrome, where you can have a Python script open Chrome, go to a URL, find a link, click it, fill out some forms, click a button, etc.
  • You would write a Python script like:
  • ```python
  • beers = load_spreadsheet_into_list_of_dicts()
  • start_up_selenium()
  • for b in beers:
  • page_text = generate_dokuwiki_text(b)
  • submit_with_selenium(page_text)
  • ```
  • `start_up_selenium` is some boilerplate for initializing Selenium and Chrome. If you don't enable headless mode you'll even see it open a Chrome window when you run the script.
  • `generate_dokuwiki_text` will be a simple function that takes a dictionary, and fills in some Dokuwiki-syntaxed text template with the information from the dictionary (the column values of that beer).
  • `submit_with_selenium` would have the actual selenium code that goes to the URL for DW's "Create Page" page, pastes the text into the text box, and clicks the "save page" button.
  • I'm purposely leaving the details vague so they can be posts on software.codidact.com (unless [Selenium docs](https://www.selenium.dev/documentation/webdriver/getting_started/first_script/)/Google aren't enough).
  • This is a little bit easier if you're self-hosting, or know the admin of the DW. Sometimes admins get mad when you run bots to create pages :)
  • Selenium is a weird way to accomplish this, but on the other hand, once you do learn how to do this kind of thing with Selenium, there's a lot of other cool things you can apply your knowledge to. So at least it's a more useful thing to learn than a specialized import plugin of one specific wiki engine.
  • While I was writing the answer, I realized that actually [Selenium](https://www.selenium.dev/) can be used to do this without any need for Dokuwiki plugins that support your specific use case. Selenium is an automated Chrome, where you can have a Python script open Chrome, go to a URL, find a link, click it, fill out some forms, click a button, etc.
  • You would write a Python script like:
  • ```python
  • beers = load_spreadsheet_into_list_of_dicts()
  • start_up_selenium()
  • for b in beers:
  • page_text = generate_dokuwiki_text(b)
  • submit_with_selenium(page_text)
  • ```
  • `start_up_selenium` is some boilerplate for initializing Selenium and Chrome. If you don't enable headless mode you'll even see it open a Chrome window when you run the script.
  • `generate_dokuwiki_text` will be a simple function that takes a dictionary, and fills in some Dokuwiki-syntaxed text template with the information from the dictionary (the column values of that beer).
  • `submit_with_selenium` would have the actual selenium code that goes to the URL for DW's "Create Page" page, pastes the text into the text box, and clicks the "save page" button.
  • I'm purposely leaving the details vague so they can be posts on software.codidact.com (unless [Selenium docs](https://www.selenium.dev/documentation/webdriver/getting_started/first_script/)/Google aren't enough).
  • This is a little bit easier if you're self-hosting, or know the admin of the DW. Sometimes admins get mad when you run bots to create pages :)
  • Selenium is a weird way to accomplish this, but on the other hand, once you do learn how to do this kind of thing with Selenium, there's a lot of other cool things you can apply your knowledge to. So arguably it's a more useful thing to learn than a specialized import plugin of one specific wiki engine.
#2: Post edited by user avatar matthewsnyder‭ · 2024-02-06T20:59:23Z (9 months ago)
  • While I was writing the answer, I realized that actually [Selenium](https://www.selenium.dev/) can be used to do this without any need for Dokuwiki plugins that support your specific use case. Selenium is an automated Chrome, where you can have a Python script open Chrome, go to a URL, find a link, click it, fill out some forms, click a button, etc.
  • You would write a Python script like:
  • ```python
  • beers = load_spreadsheet_into_list_of_dicts()
  • start_up_selenium()
  • for b in beers:
  • page_text = generate_dokuwiki_text(b)
  • submit_with_selenium(page_text)
  • ```
  • `start_up_selenium` is some boilerplate for initializing Selenium and Chrome. If you don't enable headless mode you'll even see it open a Chrome window when you run the script.
  • `generate_dokuwiki_text` will be a simple function that takes a dictionary, and fills in some Dokuwiki-syntaxed text template with the information from the dictionary (the column values of that beer).
  • `submit_with_selenium` would have the actual selenium code that goes to the URL for DW's "Create Page" page, pastes the text into the text box, and clicks the "save page" button.
  • I'm purposely leaving the details vague so they can be posts on software.codidact.com (unless [Selenium docs](https://www.selenium.dev/documentation/webdriver/getting_started/first_script/)/Google aren't enough).
  • This is a little bit easier if you're self-hosting, or know the admin of the DW. Sometimes admins get mad when you run bots to create pages :)
  • While I was writing the answer, I realized that actually [Selenium](https://www.selenium.dev/) can be used to do this without any need for Dokuwiki plugins that support your specific use case. Selenium is an automated Chrome, where you can have a Python script open Chrome, go to a URL, find a link, click it, fill out some forms, click a button, etc.
  • You would write a Python script like:
  • ```python
  • beers = load_spreadsheet_into_list_of_dicts()
  • start_up_selenium()
  • for b in beers:
  • page_text = generate_dokuwiki_text(b)
  • submit_with_selenium(page_text)
  • ```
  • `start_up_selenium` is some boilerplate for initializing Selenium and Chrome. If you don't enable headless mode you'll even see it open a Chrome window when you run the script.
  • `generate_dokuwiki_text` will be a simple function that takes a dictionary, and fills in some Dokuwiki-syntaxed text template with the information from the dictionary (the column values of that beer).
  • `submit_with_selenium` would have the actual selenium code that goes to the URL for DW's "Create Page" page, pastes the text into the text box, and clicks the "save page" button.
  • I'm purposely leaving the details vague so they can be posts on software.codidact.com (unless [Selenium docs](https://www.selenium.dev/documentation/webdriver/getting_started/first_script/)/Google aren't enough).
  • This is a little bit easier if you're self-hosting, or know the admin of the DW. Sometimes admins get mad when you run bots to create pages :)
  • Selenium is a weird way to accomplish this, but on the other hand, once you do learn how to do this kind of thing with Selenium, there's a lot of other cool things you can apply your knowledge to. So at least it's a more useful thing to learn than a specialized import plugin of one specific wiki engine.
#1: Initial revision by user avatar matthewsnyder‭ · 2024-02-06T20:57:47Z (9 months ago)
While I was writing the answer, I realized that actually [Selenium](https://www.selenium.dev/) can be used to do this without any need for Dokuwiki plugins that support your specific use case. Selenium is an automated Chrome, where you can have a Python script open Chrome, go to a URL, find a link, click it, fill out some forms, click a button, etc.

You would write a Python script like:
```python
beers = load_spreadsheet_into_list_of_dicts()
start_up_selenium()

for b in beers:
    page_text = generate_dokuwiki_text(b)
    submit_with_selenium(page_text)
```

`start_up_selenium` is some boilerplate for initializing Selenium and Chrome. If you don't enable headless mode you'll even see it open a Chrome window when you run the script.

`generate_dokuwiki_text` will be a simple function that takes a dictionary, and fills in some Dokuwiki-syntaxed text template with the information from the dictionary (the column values of that beer).

`submit_with_selenium` would have the actual selenium code that goes to the URL for DW's "Create Page" page, pastes the text into the text box, and clicks the "save page" button.

I'm purposely leaving the details vague so they can be posts on software.codidact.com (unless [Selenium docs](https://www.selenium.dev/documentation/webdriver/getting_started/first_script/)/Google aren't enough).

This is a little bit easier if you're self-hosting, or know the admin of the DW. Sometimes admins get mad when you run bots to create pages :)