How do I display an array using XUL elements like a table in HTML - xul

I have an array
data = [{'name':'Bob','email':'bob#gmail.com'}]
How can I render this array using XUL elements (like a table in HTML)?
I'm using pure Javascript (do not using any JS framework)

How do you want it to look? There's xul:listbox (example), xul:tree, and you can also use HTML table if it's exactly what you need.

Related

How I can add an ul li list element using an element of WebControls in VisualBasic

I'm working in an old project creating a User Control to add code that will change as I need.
I'd like to add a list element but I only found the property to create list type of <select> using <asp:ListBox, but this is not that I'm looking for
Do you know how generate a <ul><li> elements using Global.System.Web.UI.WebControls? or at least modify its CssClass properties since my VB code. It'd be amazing if I can use a loop to generate the list items.
Thanks in advance
One solution would be to add a BulletedList in your WebForm.aspx:
<asp:BulletedList ID="BulletedList1" runat="server"></asp:BulletedList>
Then in your WebForm.aspx.vb you can add items:
For i As Integer = 1 To 3
BulletedList1.Items.Add("item" & i)
Next
If you inspect your page in a web browser you will see these are equivalent to <ul><li> HTML tags.

Selenium web scraping elements from tag

I'm looping from a diferents urls trying to get some information from some movies
I'm trying to get the writers. I am not extracting each csselector because perhaps in some other movie there is not the same number of scriptwriters and it would give an error. For this reason I want to extract the elements that are bound to the tag. For example I want to get all the elements of the tag "a" (image attached)
I have the following code but it's not working:
driver.find_element(By.TAG_NAME,"a")
I don't know if there is any other way without using tag
url movie = "https://www.imdb.com/title/tt7740496/?ref_=watch_fanfav_tt_t_4"
I think you are using python. Try to use one of this methods:
driver.find_elements_by_xpath('(//span[contains(text(),"Guión")])[1]/../div//a')
driver.find_elements(By.XPATH,'(//span[contains(text(),"Guión")])[1]/../div//a')
Check selenium documentation: Locating Elements
My result with java code it returns 3 elements as you want.

How to initialize Materializecss form elements at run time?

I am adding form input elements at runtime, and i am using materializecss. text inputs do not render properly and I am guessing that they need to be initialized in javascript same as select or paralax. ex: ('.parallax').parallax(); , $(".select").material_select();
Is there an equivelent for form inputs for instance something like?
$('.parallax').material_input();?
Found a solution that works for me: Materialize.updateTextFields();

I need to iterate table using css selectors

I am trying to automate a page using selenium webdriver. The page contains a table which has the following xpath.
Find below a sample xpath validation which works fine.
I am iterating it through div as rows are considered as div under which there will be a table which has all the rows mentioned.
table = common.getObjectByXpath("html/body/div[4]/div[4]/div[1]/div/div/div[3]/div/div[2]/div/div/div/div");
rows = table.findElements(By.tagName("div"));
for(int i=1;i<=rows.size();i++){
if(driver.findElement(By.xpath("html/body/div[4]/div[4]/div[1]/div/div/div[3]/div/div[2]/div/div/div/div/div["+i+"]/table/tbody/tr/td[5]/span").getText().equals("endnode 11.1"))){
System.out.println(" print Something");
}
}
It works fine with xpath. But I want to do it with css selector. I am attaching the sample format of the table.
In the below figure, each div is considered as a row and under which you will see a table which has entries for columns.
The xpath you are using is a very fragile one since it starts right from the html element and heavily depends on the HTML structure of the page. Needless to say - it is huge and is not quite readable and easily understandable.
Instead rely on the element attributes - classes or ids. For example:
div#dojox_grid__View_11 div.dojoxGridContent div.dojoxGridRow

Manipulate DOM on another page in Datatables

How can I manipulate DOM on page 2 (e.g. TD) when you are in page 1 of Datatables?
Using this code isn't possible because TD of another page is not on DOM until you select page 2.
$("td").html("some code here..");
When using jQuery DataTables, you cannot access the DOM on a different screen, because DOM elements exist on the current screen only.
Instead, you can access or change the DataTable's internal value of a table cell's contents by using the cell().data() function:
myDataTable.cell(row,column).data('some code here ...');
Example Fiddle