Question: If I use the .get method in Selenium, How do I block all elements except the ones I want to load from this website to make the loading process alot faster?

This is what I have done:

```
System.setProperty("dir/chromedriver"); 
ChromeDriver driver = new ChromeDriver(); 
driver.get("url"); 
driver.findElementByCssSelector(".Name").click(); 

```

while this works with my desired parameters, The .get and .click methods wait till the page fully loads but this takes too long if I only need 2 elements on the page

Answer: 
You can keep only @user instance variable in the controller, and in partials use: @user.tasks instead of @tasks, @user.tasks.new instead of @task etc. Note also, that you can pass parameters to partials ([3.4.4 Passing Local Variables](http://guides.rubyonrails.org/layouts_and_rendering.html))

For sample:

```
<%= render partial: "your_partial", locals: {tasks: @user.tasks} %>

```

Update:

With your way (call methods from class instead of objects) you can do something like it:

```
def show
    @user = User.find(params[:id])
    if Task.between(current_user.id, @user.id).present? 
    # @user.tasks.where(another_user_field_name: current_user).present? - looks more like Rails way
      @tasks = Task.uncompleted.between(current_user.id, @user.id).order("created_at DESC").includes(:assigner).paginate(page: params[:page], per_page: 12)
      @conversation = Conversation.between(current_user.id, @user.id).first      
      if @conversation
        respond_to do |format|
          format.html
          format.js { render :template => "tasks/update.js.erb", :template => "tasks/destroy.js.erb", layout: false }
        end
      end
      # Do not forget that if @conversation is not exists this code render views by default way
    else
      redirect_to user_profile_path(@user)
    end
  end

<%= render 'conversations/show' %>
<tbody class="newtaskinsert2">
  <%= render partial: "tasks/task_between"%>
</tbody>

<%if @conversation%>
  <div class="chatboxcontent">
    <%= render '_your_messages_partial', locals: {messages: @conversation.messages.includes(:user)}%>
  </div>
  <div class="chatboxinput">
    <%= form_for([@conversation, @conversation.messages.new], :remote => true, :html => {id: "conversation_form_#{@conversation.id}"}) do |f| %>
      <%= f.text_area :body, class: "chatboxtextarea", "data-cid" => @conversation.id %>
    <% end %>
    <%= form_for([@conversation, @conversation.messages.new], html: {class: "refile_form"}, remote: true) do |form| %>
      <span class="btn btn-success btn-sm btn-file">Choose file
      <%= form.attachment_field :message_attachment, direct: true, presigned: true, class: "choosefile" %></span>
      <%= form.submit "Send File", class: "btn btn-primary btn-sm btn-submit-refile", style:"display:none"%>
    <% end %>
    <span id="progresspercent"></span>
  </div>
<% end %>

```

You can make this code more shorter in case of using relations (@user.conversations instead of Conversation.between... etc)
I would suggest to use caching techniques for your views:

<http://edgeguides.rubyonrails.org/caching_with_rails.html#fragment-caching>
<http://edgeguides.rubyonrails.org/caching_with_rails.html#russian-doll-caching>

In the extreme scenario where performance is still an issue for you, I would recommend to start denormalising the partials until you re happy with the performance.