sseerrppeenntt

sseerrppeenntt

Advice for a web automation project

Hello friends,

I am seeking advice on how to proceed with my personal web automation project. :slight_smile:

In recent months I finished my first back-end app using Python on a Linux server. I use it to watch over a clothing website’s homepage, that is the appearance of new product notification modals DOM changes, to send myself a push notification to my phone using the Matrix CLI utility matrix-commander when a new product is added. The whole app is built upon Selenium/ChromeDriver library’s explicit wait loops.

Python example:

WebDriverWait wait = new WebDriverWait(driver,30);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.ID("garment")));

With the introduction out of the way, let’s look at the “problem”. I would like to rebuild this app using Elixir; for these reasons:

  • a fun experience to learn Elixir
  • better interoperability with my Phoenix app

I am but an Elixir novice, therefore I have many questions:

  1. What app structure would you suggest? In Python it was simply a deeply nested loop that corrected itself with another loop on an error-raise, but I am unsure how I would do this in Elixir.
    1.1. How would you utilize Elixir’s fault-tolerance to keep this “sentry app” running?
    1.2. If I wanted it running alongside a Phoenix app, is an Elixir umbrella project a suitable option?
    2. The most mature library for web automation using ChromeDriver seems to be Wallaby, but it’s implementation is with the ExUnit test blocks (now feature blocks) and I am unsure if it would work outside these ExUnit tests. Is it possible to run such code without the feature block? Or is it better to somehow run the program in them? Example code:
  feature "users can create todos", %{session: session} do
    session
    |> visit("/todos")
    |> fill_in(text_field("New Todo"), with: "Write my first Wallaby test")
    |> click(button("Save"))
    |> assert_has(css(".alert", text: "You created a todo"))
    |> assert_has(css(".todo-list > .todo", text: "Write my first Wallaby test"))
  end

I would be grateful for any insights that you might bring. :heart:

Most Liked

sodapopcan

sodapopcan

The company I used to work for did use Wallaby outside of testing in production code, so I know it’s possible. Unfortunately I barely worked in that area of the codebase and when I did, it was only touching our wrappers. I know my former-colleagues do lurk around here but they rarely post, so I’m not sure if they will see this. The best I can offer is a tiny bit of reassurance that if you go down that path it probably won’t be in vain.

You otherwise likely weren’t getting traction here as your first question is very general about Elixir. GenServers and Supervisors are what you are looking for as they are the basic building blocks of long running fault-tolerant systems akin to the Python code described.

dimitarvp

dimitarvp

Sorry that you had no engagement. Have you tried something that you can show here so maybe then people can give more concrete advice?

Where Next?

Popular in Questions Top

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
makeitrein
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project. Baby step #1 is extracting the number ...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

Other popular topics Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement