teleren/devto huggingface dataset:
what is a locator in Selenium (and Python)
Tags: selenium, python, automation
Published: 2019-07-25 12:24:48

---
title: what is a locator in Selenium (and Python)
published: true
description: 
tags: selenium,python,automation
---

In order to interact with a web page in Selenium you have to locate the element. As a human you do this without much thought. In Selenium it requires more thought (sadly).


There are lots of ways to find elements on a page. The most specific way is by id. Meaning there is an element on a page and it has a unique id on it. If you looked at the HTML source a unique id would look like this:

```html
<button id="mybutton">click me</button>
```

When you have a button that has an id on it then you can locate it in Python like this

```python
e = driver.find_element_by_id("mybutton")
```

Another way to do the exact same thing as above but the code is slightly different.

```python
from selenium.webdriver.common.by import By # note 1
e = driver.find_element(By.ID,"mybutton")
```

Note 1 - you need another import for this code to work.

If you want to use an XPath locator the code will look like this

```python
driver.find_element(By.XPATH, '//button[text()="click me"]')
```

There is also a way to find multiple elements that match the same locator by using the find_elements method instead of find_element.

See here for lots more information and all of the other locator types: https://selenium-python.readthedocs.io/locating-elements.html
Browser API's localization: why can't you do this, Chrome?
Tags: chrome, google, javascript, browser
Published: 2019-09-06 13:24:59

Hey, devs! I'd like to share an interesting thing I've found, and ask your thoughts about it.

I was playing with `Date`'s `toLocaleString()` method in order to get a month name translated with the browser's API only. The code looks like this:

```javascript
const date = new Date();
date.toLocaleString('en-GB', { month: 'long' });
```

I tested it in my Chrome browser with a few different languages, everything was perfect. The interesting part has appeared when I posted it on Instagram:

{% instagram B1_r-2RCKcW %}

I've got a comment from one of my followers trying to apply this technique for getting an Armenian translation of the month name. According to [ISO Language Code Table](http://www.lingoes.net/en/translator/langcode.htm) the language code for Armenian language is `hy-AM`. I've tried that by myself and discovered that it doesn't really work in Chrome browser (you can see it on the head picture). For some reason, it returns `M09` (no idea what that means).
But at the same time, it works as expected in Mozilla Firefox:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/pf5mrbcupm1r8fmz90l9.png)

I've asked Google Chrome team on twitter already:

{% twitter 1169965679392514048 %}

Let's see if we get any thoughts on this issue from them. Please, feel free to share your ideas too...

Thanks for reading and have an amazing weekend!
Embracing a mentality of prediction – evaluation – exploration
Tags: reflection, learning, life
Published: 2019-09-12 22:43:22

---
title: Embracing a mentality of prediction – evaluation – exploration
published: true
tags: Reflection,Learning,Life
canonical_url: https://cleandatabase.wordpress.com/2019/09/12/embracing-a-mentality-of-prediction-evaluation-exploration/
---

A while ago I started to play a little game when doing test-driven development:

Every time I run my microtest, I predict the outcome. Will the test fail or pass?  
When my prediction was right, I continue. When it was not right, I investigate and explore why my code behaved differently than I thought it would be. I will not simply go on and poke around (though I do that frequently, too) but really try to understand why my expectation of the code’s behavior was different to reality.

When I found the cause for the wrong prediction, I try to learn from reality and grow my knowledge about the code. Sometimes I not only find gaps in my knowledge but also flaws in my work process or in the way I do things.

I found this game to be a very powerful tool of learning. I’m still not very seasoned in doing it, but it’s something I want to practice more often.

Today I realized that I can not only use this technique for TDD, but for many different things in software development and also life. We are constantly predicting what will happen, what consequences our actions will have:

Will my code work after merging that branch?  
What will change when I change this setting?  
Will I catch the bus when I go now?  
Will I need an umbrella today?  
How will my co-worker react to the feedback I give him?

We constantly predict, but I usually don’t evaluate the outcome in reality and explore the reasons when my prediction was wrong. In not doing the evaluation and exploration, I probably miss a powerful tool to consciously learn and instead stick with a very unconscious and probably tedious trial-and-error approach.

That’s something I want to change: What will happen when I start to notice the predictions I’m doing all the time, when I consciously evaluate their outcome and explore why my prediction was wrong?

My prediction is that I will not only learn faster and become more aware of myself and the things around me, but might also find flaws in my thinking, in the way I approach things and in beliefs I hold.

Sounds like quite some effort and also a bit scary, but I want to try it out.

I would love to hear your thoughts on that!
In the Guts of a Shiv App - Building SaaS #24
Tags: python, django, saas
Published: 2020-01-21 18:02:51

{% youtube 0kS-uPMOLlg %}

In this episode, we got our hands dirty with the Django Shiv app that we build to work out issues with finding templates and other settings problems.

Show notes for this stream are at [Episode 24 Show Notes](https://www.mattlayman.com/building-saas/guts-shiv-app/).

To learn more about the stream, please check out [Building SaaS with Python and Django](https://www.mattlayman.com/building-saas/).
That was quite an episode...
Tags: ruby, rails
Published: 2019-09-22 22:08:21

<h1><center>Rails + React + Redux - Pt 5</center></h1>
*********************************************************

This post is going to focus on creating an Appearance for each queen. I'll iterate through each Episode's contestants' ids to find_or_create_by the contestants' drag_names then create the Appearance using the Episode and Queen ids. 

*********************************************************
<h1><center> Let's get started! </center></h1>
*********************************************************

*1. Def get_seasons in season.rb to scrape the list of season names from Fandom, concatenate each season name into an array of URLS for each Season's Wikipedia page, then iterate through the array to .create!() an instance of each Season.*

<center>__see previous posts for the gist__</center>

*2. Def get_queens in queen.rb to scrape the list of queens' names from Fandom, concatenate each queen's name into an array of URLs for each Queen's Fandom page, then iterate through the array to .create!() an instance of each Queen and her attributes (including associations for Quotes and Trivia.*

<center>__see previous posts for the gist__</center>

*3. With Seasons and Queens instantiated, iterate through the Seasons and .create!() an appearance for each episode per Queen and her appropriate appearance attributes.*

{% gist https://gist.github.com/JaredHarbison/03fd7f86b43369ac97adeb03eba06e31 %}

A subsequent post will include the last in the scraping segment of the project, where I'll gather the queens stats from each episode and store them with her appearance! Then I'll have enough data to start creating the user interface.

*********************************************************
<h1><center> That's all folks! </center></h1>
Half Done...
Tags: blogging, mom
Published: 2019-09-22 23:57:20

As a mother to a very active child I have a habit of leaving things half finished. Shelves of half read books and folders on my computer full of half completed projects. There just never seems to be time to finish especially if I would like to sleep like a normal functioning human.

So how do you get over this problem? I still haven't figured out how to get through my overwhelming stack of books. That is a mystery that may never be solved. My advice for getting through that stack of half finished projects while you have a small human in tow is as follows:

1.Let them see what you are working on. You will never have the free time to work alone unless they are in school, but if you are employed during that time frame your free time to learn that new skill is as elusive as seeing a unicorn. If you let them see what you are working on whether they understand why it works or not you bring them in instead of pushing them away. Truthfully the minute I start to explain what I'm working on to my son he stops crawling up my face to get attention because he feels included in the experience. Then slowly as if by magic he then wanders away and gives me the five minutes I need to figure out why the damn click function won't work no matter which way I write it. (more often then not it's because I'm distracted and missed a semi colon.

2.Build things you might need in your day to day life. As a content creator and everyday human my life needs organization. I realized when I became part of the Twitch community many moons ago that being a content creator is a special kind of job with special requirements of your time. So I wondered if people like me felt like the regular day planner wasn't organized in a way that would allow them to accomplish everything they needed. So I began to build a day planner specific to what I felt the needs of a content creator were. Then yesterday I realized what a cool idea it would be to have an app that allowed me to keep track of good behavior and chores for my son so that maybe he could earn an allowance. So I started work on said app. Both of these projects are open tabs on my laptop. I work a little on one and when I get stuck I move to the other. This means that no matter what I have accomplished something and feel like the time I took for myself meant something.

I feel like as wives and mothers trying to learn a new skill or just do something for ourselves is hard for us. There is always somebody to take care of and you are normally last on that list. If coding is your new found passion as it is for me then you desperately need to take that five minutes for yourself. Even if you can't code. Read somebody else's blog post, do one practice exercise or follow one coder on your favorite social media spot. Do one thing everyday to further your goal. Finish your projects one piece at a time. There is a light at the end of the tunnel and I swear it isn't just the glare of your computer screen.
Why You Should Use Windows VPS Hosting for a Growing Website
Tags: vpshosting
Published: 2019-09-23 13:10:23

A VPS or virtual private server hosting plan is responsible for providing the user site with own set of resources like- operating system, disk space, and bandwidth. This is a huge contrast when compared to other hosting plans, where most of the resources are shared with other users present on the server. VPS hosting gives the users a more optimized service for their website visitors and this can be essential as the user looks to grow and expand his site.

Here, in this article, I'll be sharing the top reasons that a website owner needs to consider when he decides to upgrade his website using a Windows VPS Hosting.

**Why Use Windows VPS Hosting?**
1.	Cost-Effective Solution
As the business website grows with time, the budgeting of the sites becomes more and more challenging with time. The website owner needs to dedicate his time and money for growing his site. If he decides to invest in a shared hosting system, then this can prove to be a waste of money, as it is a cost-ineffective solution. Also, if the user is looking not to overspend and getting a dedicated server in return for his site, then VPS hosting is the best of the available hosting solution. 
 
2.	No Sharing and Draining of Resources
One of the major pitfalls of shared hosting is that the resources of the servers are being accessed by multiple websites. If any other website encounters an abrupt spike in the traffic, then the user might go down with limited resources available in-hand. This would result in slower loading time, with reduction in traffic and conversions. It is not an ideal solution for the websites that are looking to expand and also it doesn't give a professional look-and-feel to the business website. Having a VPS hosting, gives website owners their own set of resources and are not at all affected by the excessive resource usage by others. Thus, they experience a faster, smoother experience for their visitors.
 
3.	Higher Security
VPS hosting is considered to be more secure than any other shared hosting service available. This is mainly due to the fact that the apps and data present on the virtual server are fully isolated from other users on the server. Separated storage available on the virtual servers means that it very difficult for the virus and other infections to spread across the users.

4.	More Control Over the Site
As a VPS hosting plan is free of other user accounts that use the same physical server, the website owners have more extent of control on the partition. Each user gets his own operating system along with full access to the available files and resources. VPS hosting plans are incredibly simple for the businesses that are going for an upgrade with growth in their business. The website owner needs to pay for only what he uses.
How to Rename a Modern SharePoint Site URL in Office 365
Tags: office365, sharepoint, collaboration, modernsharepoint
Published: 2019-10-22 20:23:09

---
title: How to Rename a Modern SharePoint Site URL in Office 365
published: true
tags: Office 365,SharePoint,Collaboration,Modern SharePoint
canonical_url: https://blogit.create.pt/miguelisidoro/2019/09/23/how-to-rename-a-modern-sharepoint-site-url-in-office-365/
---

The post [How to Rename a Modern SharePoint Site URL in Office 365](https://blogit.create.pt/miguelisidoro/2019/09/23/how-to-rename-a-modern-sharepoint-site-url-in-office-365/) appeared first on [Blog IT](https://blogit.create.pt).

This posts explains how to rename a Modern SharePoint site URL in Office 365.

## Introduction

Site URL Rename has been one of the most popular requests via [UserVoice](https://sharepoint.uservoice.com/forums/329214-sites-and-collaboration/suggestions/13217277-enable-renaming-the-site-collection-urls) and in [SharePoint Conference 2019](https://dev.to/mlisidoro/what-s-new-for-sharepoint-and-office-365-from-sharepoint-conference-2019-part-2-o5g), in one my favorite announcements of the event, Microsoft finally announced the possibilty to rename a Site URL.

This can be done either using the SharePoint Admin Center or using a PowerShell script.

## How It Works

### Using the SharePoint Admin Center

The easiest way to rename a site URL is using the SharePoint Admin Center. Select “Active Sites”, then the site you want to rename and click “Edit”.

![](https://i0.wp.com/blogit.create.pt/wp-content/uploads/2019/09/SharePoint_RenameSiteURL_AdminCenter.jpg?fit=696%2C288&ssl=1)<figcaption>Renaming a Site URL using SharePoint Admin Center</figcaption>

A popup will appear and the only thing you have to do is to write the new URL and ensure that the new URL is not being used.

![](https://i1.wp.com/blogit.create.pt/wp-content/uploads/2019/09/SharePoint_RenameSiteURL_AdminCenter_Popup.jpg?w=696&ssl=1)<figcaption>Set the new URL for the SharePoint site</figcaption>

To read the entire article, click [here](https://blogit.create.pt/miguelisidoro/2019/09/23/how-to-rename-a-modern-sharepoint-site-url-in-office-365/).

Happy SharePointing!

The post [How to Rename a Modern SharePoint Site URL in Office 365](https://blogit.create.pt/miguelisidoro/2019/09/23/how-to-rename-a-modern-sharepoint-site-url-in-office-365/) appeared first on [Blog IT](https://blogit.create.pt).
Command Execution Tricks with Subprocess - Designing CI/CD Systems
Tags: python, subprocess, ci, continuousdelivery
Published: 2019-10-01 02:10:12

---
title: Command Execution Tricks with Subprocess - Designing CI/CD Systems
published: true
tags: python, subprocess, ci, continuousdelivery
canonical_url: https://tryexceptpass.org/article/continuous-builds-subprocess-execution/
cover_image: https://tryexceptpass.org/images/continuous-builds-execution.webp
---

The most crucial step in any continuous integration process is the one that executes build instructions and tests their output. There’s an infinite number of ways to implement this step ranging from a simple shell script to a complex task system.

Keeping with the principles of simplicity and practicality, today we’ll look at continuing the series on [Designing CI/CD Systems](https://tryexceptpass.org/designing-continuous-build-systems) with our implementation of the execution script.


Previous chapters in the series already established the [build directives](https://tryexceptpass.org/article/continuous-builds-parsing-specs/) to implement. They covered the format and location of the build specification file. As well as the [docker environment](https://tryexceptpass.org/article/continuous-builds-docker-swarm) in which it runs and its limitations.

## Execution using subprocess

Most directives supplied in the YAML spec file are lists of shell commands. So let's look at how Python's [subprocess](https://docs.python.org/3/library/subprocess.html) module helps us in this situation.

We need to execute a command, wait for it to complete, check the exit code, and print any output that goes to stdout or stderr. We have a choice between `call()`, `check_call()`, `check_output()`, and `run()`, all of which are wrappers around a lower-level `popen()` function that can provide more granular process control.

This `run()` function is a more recent addition from Python 3.5. It provides the necessary execute, block, and check behavior we're looking for, raising a `CalledProcessError` exception whenever it finds a failure.

Also of note, the [shlex](https://docs.python.org/3/library/shlex.html) module is a complimentary library that provides some utilities to aid you in making subprocess calls. It provides a `split()` function that's smart enough to properly format a list given a command-line string. As well as `quote()` to help *escape* shell commands and avoid shell injection vulnerabilities.

## Security considerations

Thinking about this for a minute, realize that you're writing an execution system that runs command-line instructions as written by a third party.  It has significant security implications and is the primary reason why most online build services do not let you get down into this level of detail.

So what can we do to mitigate the risks?

[Read On ...](https://tryexceptpass.org/article/continuous-builds-subprocess-execution/)
How to integrate Endtest with BrowserStack
Tags: webdev, testing, productivity, devops
Published: 2019-09-25 14:25:54

---
title: How to integrate Endtest with BrowserStack
published: true
description: Codeless Automated Testing for Mobile Apps with Endtest and BrowserStack
tags: webdev, testing, productivity, devops
cover_image: https://thepracticaldev.s3.amazonaws.com/i/61k02d7k2t18rhhflj46.png
---

###**Introduction**###
[Endtest](https://endtest.io) allows you to create, manage and execute Automated Tests, without having to write any code. 
 
By integrating with [BrowserStack](https://www.browserstack.com/), you can execute Mobile Tests created with Endtest on a range of real Android and iOS mobile devices offered by BrowserStack.

###**Getting Started**###

1) Go to your **BrowserStack** account.
2) Click on **App Automate** from the **Products** section:

![BrowserStack App Automate](https://thepracticaldev.s3.amazonaws.com/i/pa2x1o3afik565slagjr.png)

3) Click on the **Show** button from the **Username and Access Keys** section from the left side of the page:

![BrowserStack App Automate](https://thepracticaldev.s3.amazonaws.com/i/isjvsfcdhd57sqkaymb0.png)

4) Go to the **Settings** page from [Endtest](https://endtest.io).
5) Add the **Username** and **Access Key** from BrowserStack App Automate in the BrowserStack User and BrowserStack Key inputs from the Endtest Settings page.

![Endtest BrowserStack](https://thepracticaldev.s3.amazonaws.com/i/6pf5qsifvp6nqhkawouz.png)

6) Click on the **Save** button.

Nice job! Your Endtest account is now connected with your BrowserStack account.

###**Running your first test**###

1) Upload your APK or IPA file in the **Drive** section from Endtest.

![Endtest Drive](https://thepracticaldev.s3.amazonaws.com/i/0fmm95fgewc7c6xhlnmy.png)

2) After that, go to the **Mobile Tests** section and click on the Run button.

![Endtest Execution](https://thepracticaldev.s3.amazonaws.com/i/5w45idfu6aep1dp2iqgk.png)

3) Select **BrowserStack** from the **Grid** dropdown.

4) Select the **Platform** and the **Real Device** on which you want to execute your test on.

5) Select your APK file in the **APK Download URL** input.
If you select an iOS device, the **APK Download URL** input would be replaced with the **IPA Download URL** input.

After starting the test execution, you will be redirected to the Results section where you'll get live video and all the results, logs and details in real-time.
Let's Fix Some A11y Issues this Hacktoberfest 👩‍💻👨‍💻
Tags: a11y, hacktoberfest, webdev, showdev
Published: 2019-09-30 05:50:35


With Hacktoberfest just around the corner I started thinking about what I would like to contribute this year (both in October and going forward). 

Over the course of the year I've been doing my best to be an advocate for accessibility in web applications, and so I thought a natural thing to do would be to **help improve accessibility in Open Source, one Pull Request at a time**!

## Would you like to join me?

I've added a page over at [Up Your A11y: Open A11y OSS Issues Looking for Help](https://www.upyoura11y.com/contribute-to-a11y-in-oss) to help identify issues actively looking for contributors.

You'll find open GitHub issues that:

- Are from open source projects
- Reference 'a11y', 'accessibility', or 'accessible'
- Have the "Help wanted" or "Good first issue" label
- Have no assignee or pull request yet
- Are for JavaScript or HTML projects

## Have a great Hacktoberfest 

Whatever you end up doing this year and beyond in OSS, happy coding! 👩‍💻👨‍💻

--------
*Did you find this post useful? Please consider [buying me a coffee](https://www.buymeacoffee.com/mgkZuRU) so I can keep making content* 🙂