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

9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
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
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
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Other popular topics Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 42920 311
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
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
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement