Generating Code Based on a Table in Julia - sequence

I have a sequence of code:
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:dc ATTR=ID:minSEARCH_CLOSED_DATE CONTENT=1-1-2010
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:dc ATTR=ID:maxSEARCH_CLOSED_DATE CONTENT=1-2-2010
I need to change
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:dc ATTR=ID:minSEARCH_CLOSED_DATE CONTENT=1-1-2010
and
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:dc ATTR=ID:maxSEARCH_CLOSED_DATE CONTENT=1-2-2010
to be the next two day period:
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:dc ATTR=ID:minSEARCH_CLOSED_DATE CONTENT=1-3-2010
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:dc ATTR=ID:maxSEARCH_CLOSED_DATE CONTENT=1-4-2010
so that the resulting full set of code has entries for every two day period from 1-1-2010 to 12-31-2013.
I have generated a DataFrame that has every one of these dates (code posted below). I don't know if referencing this table will be the easiest way to alter the dates, but it was one method I was thinking of. I also do not know if Julia can solve my question, but it is one of the languages I feel more comfortable with.
a=collect(Date("2010-01-01"):Dates.Day(1):Date("2013-12-31"))
dates=DataFrame(Dates=a)
An excerpt of what the final code should look like is shown below.
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:dc ATTR=ID:minSEARCH_CLOSED_DATE CONTENT=1-1-2010
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:dc ATTR=ID:maxSEARCH_CLOSED_DATE CONTENT=1-2-2010
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:dc ATTR=ID:minSEARCH_CLOSED_DATE CONTENT=1-3-2010
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:dc ATTR=ID:maxSEARCH_CLOSED_DATE CONTENT=1-4-2010
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:dc ATTR=ID:minSEARCH_CLOSED_DATE CONTENT=1-5-2010
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:dc ATTR=ID:maxSEARCH_CLOSED_DATE CONTENT=1-6-2010

Related

How to handle nested attributes in HTMX

I have a table like structure in my page and each row has data-hx-get attribute pointing to a url where django returns details for that row. But also in the same row I have an edit button where django returns the edit form for that item. I would like the entire row to be clickable and when clicked shows replaces itself with the details and also the edit button to replace the row with the form. It works fine for the users but when the edit button inside the row is clicked, in the console I get htmx:swapError as the row also receives the click event and does what it was supposed to do. The event on the button takes precedence and before the row it changes the content of the row and when the row gets the response, the data-hx-target for that is no more in the page. So, my question is, is there a way to tell htmx, when a nested element has data-hx-get, ignore the parent's hx directive.
<div
class="row item-row"
id="item-row-{{item.pk|unlocalize}}"
data-hx-get="{% url 'some url' item.pk %}
data-hx-swap="outerHTML"
data-hx-trigger="click"
data-hx-target="this">
...
<button
data-hx-get="{% url 'editurl' item.pk %}"
data-hx-swap="outerHTML"
data-hx-trigger="click"></button>
</div>
You can use the consume modifier for hx-trigger https://htmx.org/attributes/hx-trigger/. This will prevent the click event from bubbling up to the parent row.
<div
class="row item-row"
id="item-row-{{item.pk|unlocalize}}"
data-hx-get="{% url 'some url' item.pk %}"
data-hx-swap="outerHTML"
data-hx-trigger="click"
data-hx-target="this">
...
<button
data-hx-get="{% url 'editurl' item.pk %}"
data-hx-swap="outerHTML"
data-hx-trigger="click consume"></button>
</div>

How to locate, link element inside div tag by value using css selector in webdriver?

This is code for a button "Signup here" in div tag. I have run this code though Xpath working Fine but I want to alternate method with css selector locator element in selenium Webdriver.
<div>
Signup here
</div>
driver.findElement(By.cssSelector("a[href='signup']")).‌​click();
Try one of these CSS selectors:
a[text()="Signup here"]
or
a.divclass
or
a[href="signup"]

iMacro: test resulting URL

Using iMacro (chrome extension), I would like to automate an action on a website:
check a checkbox (conditions)
click button (submit)
then compare the resulting url to a string
if true ==> restart script from beginning
if false ==> show a popup message (or anything else Alerting the user)
I started from here after recording steps 1 and 2 which works fine and can run in loop
VERSION BUILD=8350307 RECORDER=CR
URL GOTO=http://websitew.com/5421/0
REFRESH
TAG POS=1 TYPE=A ATTR=HREF:http://websitew.com/5421/0#
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ID:FormBookingCreate ATTR=ID:condition CONTENT=YES
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:FormBookingCreate ATTR=NAME:nextButton
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:FormBookingCreate ATTR=NAME:finishButton
Further, it doesn't accept if satement, and I don't know how to inform the user with some kind of messagebox or alert
SET current {{!URLCURRENT}}
#if current = "http://websitew.com/5421/0" then
MsgBox "OK!"
else
"""start from the beginning """
Try this solution for the Chrome 'iMacros' extension:
' here your code with the 1st and 2nd steps '
SET S EVAL("('{{!URLCURRENT}}' == 'http://websitew.com/5421/0') ? 'alert(\"OK!\");' : 'undefined';")
URL GOTO=javascript:{{S}}
' uncomment the line below to stop your macro after a message box '
'SET E EVAL("('{{S}}' == 'undefined') ? '' : MacroError('STOP!');")

Remove all text between a <p> tag

I have a <p> tag that looks like this:
<p class=\"padding-top\" style=\"padding:0;margin:0 0 1em;line-height:1.35;padding-top:18px\">
I want to know what's the regex to remove the content between this tag. I tried <p([^>]+)>([^>]+)</p>
but it won't work.

Clicking HTML button programmatically

There is a website which has 4 web pages. On first page there is a button, On 2nd page there are also some buttons, on 3rd page there is also a single button, and 4th page also contained a single button. Problem is that my code programmatically clicks the button of first page 2nd page and 3rd page. But is is not clicking the button on 4th page programmatically. How can I enable my code to do that? Please suggest a reliable solution for this .. The HTML code of the button is given below
<FORM NAME='form1' METHOD='post' action='/dflogin.php'><INPUT TYPE='hidden' NAME='txtId' value='E712050-15'><INPUT TYPE='hidden' NAME='txtassId' value='1'><INPUT TYPE='hidden' NAME='txtPsw' value='HH29'><INPUT TYPE='hidden' NAME='txtLog' value='0'><h6 align='right'><INPUT TYPE='SUBMIT' NAME='btnSub' value='Next' style='background-color:#009900; color:#fff;'></h6></FORM>
This code clicks a button programmatically, you should be able to adapt this to what you need and hopefully it should work for you.
For Each webpageelement As HtmlElement In allButtons
If webpageelement.GetAttribute("value").Equals("Next") Then
webpageelement.InvokeMember("click")
Exit For
End If
Next